Click here to Skip to main content
15,881,803 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Java
public void onSuccess(String response){
				try{
					JSONObject obj = new JSONObject(response);
					
						//Toast.makeText(getApplicationContext(), "Success", Toast.LENGTH_SHORT).show();
						if(obj!=null){
						
						JSONArray data = obj.getJSONArray("CheckDuplicateSupplierRegistration");
						for(int i=0;i<data.length();i++)>
        				{
        					JSONObject user = data.getJSONObject(i);
        					
        						
        						String sid=user.getString("ID");
        						String name=user.getString("sSubscriberName");
        						if(sid.equals(name)){
        						//navigate();
        							//name=user.getString("sSubscriberName");
        						Toast.makeText(getApplicationContext(), "Success", Toast.LENGTH_SHORT).show();
        						}
        					
        				}
						}
						else{
							Toast.makeText(getApplicationContext(), "Try Again", Toast.LENGTH_SHORT).show();
						}
						
					
				}catch(JSONException e){
					Toast.makeText(getApplicationContext(), "Error Occured [Server's JSON response might be invalid]!", Toast.LENGTH_LONG).show();
                    e.printStackTrace();
        		
				}
				
			}
Posted
Updated 25-Mar-15 23:28pm
v2
Comments
Herman<T>.Instance 26-Mar-15 10:38am    
Which exception? What line causes it. Furthermore. What's the question?
Rahul Ramakrishnan 27-Mar-15 0:43am    
i need to get user input and compare it with json data. if the name is same toast name exists.
the exception that i get is Error Occured[server json response might be invalid]!

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