Click here to Skip to main content
15,881,852 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
Anybody know... just check all data string in hush map is correct or not. If correct can go next page ,else "NOT FOUND"

Java
class LoadContentFromServer extends AsyncTask<Object, Integer, Object>{
		@Override
		protected Object doInBackground(Object... params) {
			// TODO Auto-generated method stub
			String url = "http://192.168.1.109/Wow/?Type=go1";
			String ckCode = "";
			JSONObject data;
			JSONArray dataset;
			myArrList = new ArrayList<HashMap<String, Object>>();
			
			try {
				data = new JSONObject(getJSONUrl(url));
				dataset = data.getJSONArray("stock");
				myArrList = new ArrayList<HashMap<String,Object>>();
				List = new ArrayList<String>();
				HashMap<String, Object> map;
				for (int i = 0 ; i < dataset.length(); i ++){
						JSONObject c1 = dataset.getJSONObject(i);
						map = new HashMap<String, Object>();
						myArrList.add(map);
						map.put("code", c1.getString("code").toString());
						publishProgress(i);
						
					}
				}
			} catch (Exception e) {
				// TODO: handle exception
			}
			return null;
		}


OnClick Nextpage..
Java
public void next(View view){
        Intent nextScreen = new Intent(getApplicationContext(), FragmentGO.class);
        if(  ){
            startActivity(nextScreen);
        }
        else{
	    Toast.makeText(getApplicationContext(),"NOT FOUND",Toast.LENGTH_LONG).show();
	}
    }


thanks from suggestion :D
Posted
Updated 13-Aug-14 21:07pm
v2
Comments
TorstenH. 14-Aug-14 2:09am    
never seen before - I assume it's written by you.

What is the question?

If it's not working: Your catch is empty - BIG MISTAKE! at least some e.printStackTrace(); should be in there.
Sergey Alexandrovich Kryukov 14-Aug-14 2:43am    
Big mistake indeed!
—SA
Eerven 14-Aug-14 3:05am    
thx TorstenH
Sergey Alexandrovich Kryukov 14-Aug-14 2:44am    
And what is the criteria for "correctness"?
—SA
Eerven 14-Aug-14 3:25am    
well, there's input from user text1. I going to check all data in hash map that's match text1. my qestion a bit confuse..

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900