title: how to compare JSON object with a string in android?
body: <p>Below is the code. The code works perfectly fine. It displays the content when both the EditText is left blank or has some string value that is available in the mysql database . My problem is that i want to display an error message when the <strong>input</strong> from the editText does not match with the JSON object or the <strong>returnString</strong> that store the result of the Mysql query after decoding <strong>JSON</strong>. </p>
  
  <p>for eg if input='abi' //input from edittext</p>
  
  <pre><code>      khasi:abirt //khasi is column from the database with value abirt
  </code></pre>
  
  <p>output : khasi abirt will be displayed </p>
  
  <p>but i want an error to be displayed when input does not match at all with any of the words from the <em>khasi</em> column of the database instead of a blank page activity.</p>
  
  <p>for eg :  input='kljfldskfsldhf'</p>
  
  <pre><code>      khasi column does not consist the input word 
  </code></pre>
  
  <p>outout : blank page activity</p>
  
  <pre><code> String result;
  
   String returnString;// to store the result of MySQL query after decoding JSON
  
   String input;
  
   TextView tv;
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder()
        .detectDiskReads().detectDiskWrites().detectNetwork() // StrictMode is most commonly used to catch accidental disk or network access on the application's main thread
        .penaltyLog().build());
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_display_meaning);
  
          Intent intent = getIntent();
  
          intent.setClass(DisplayMeaningActivity.this, MainActivity.class);
  
          input =intent.getStringExtra(MainActivity.MEANING_INPUT);
  
           tv = (TextView) findViewById(R.id.textView1);
  
  
      // declare parameters that are passed to PHP script i.e. the name "meaning" and its value submitted by user   
       ArrayList&lt;NameValuePair&gt; postParameters = new ArrayList&lt;NameValuePair&gt;();
  
    // define the parameter
  
       String response = null;
  
    // call executeHttpPost method passing necessary parameters 
       try {
  response = CustomHttpClient.executeHttpPost(
    "http://kffg.netii.net/konnect.php?name="+input, // your ip address if using localhost server
    postParameters);
  
   // store the result returned by PHP script that runs MySQL query
  String result = response.toString();
  
  //parse json data
   try{
           returnString = "";
     JSONArray jArray = new JSONArray(result);
           for(int i=0;i&lt;jArray.length();i++){
                   JSONObject json_data = jArray.getJSONObject(i);
                   Log.i("log_tag","ID: "+json_data.getInt("ID")+
                           ", Khasi: "+json_data.getString("Khasi")+
                           ", English: "+json_data.getString("English") 
                   );
                 //Get an output to the screen
  
                   returnString += "\n\n" + "Kyntien  : " + json_data.getString("Khasi") + "\n"+ "Meaning: " + "\n"+ "" + json_data.getString("English");
  
           }
  
  
   }
   catch(JSONException e){
           Log.e("log_tag", "Error parsing data "+e.toString());
   }
  </code></pre>