title: In Android How to show message when data is Changed into Database?
body: <p>I need to show the message in Android Java Class when the Data is Changed into the Database. What method has to be used to do this?? </p>
  
  <p>Please help me , I dont have any Idea about this. </p>
  
  <p>This is my PHP Code:</p>
  
  <pre><code>    &lt;?php
      $tableid=$_POST['Tableid'];
      $status=$_POST['Status'];
      include '../../dbconnect.php';
      if($status=='All')
      {
      $oidquery="select orderid, orderstatus from din_orders where tableid=$tableid  &amp;&amp;      orderstatus!='Pending'";
      }
      else
      {
       $oidquery="select orderid,orderstatus from din_orders where tableid=$tableid &amp;&amp;        orderstatus='$status'";
      }
     $result=mysql_query($oidquery);
     while($ordersrow=mysql_fetch_object($result))
      {
     $ordersarray[]=$ordersrow;
      }
     echo json_encode(array('orders'=&gt;$ordersarray));
     ?&gt;
  </code></pre>
  
  <p>For Example: In a Table "OrderStatus" Initially It shows as "Pending" later manually I will change "Pending" as "Delivered". When this change takes place in Database I should get a message in Android Java Class as "Items Delivered".</p>
  
  <p>Here is my Android Java Code:</p>
  
  <pre><code>    public void ordersdisplay() {
      String selectedstatus1 = (String) status.getSelectedItem();
      ArrayList&lt;NameValuePair&gt; nameValuePairs = new ArrayList&lt;NameValuePair&gt;();
      ArrayList&lt;HashMap&lt;String, String&gt;&gt; mylist = new ArrayList&lt;HashMap&lt;String, String&gt;&gt;();
      nameValuePairs.add(new BasicNameValuePair("Tableid", tableid1));
      nameValuePairs.add(new BasicNameValuePair("Status", selectedstatus1));
      InputStream is = null;
      String result = "";
      JSONObject JArray = null;
      try {
          HttpClient httpClient = new DefaultHttpClient();
          HttpPost httpPost = new HttpPost(url + "order_status.php");
          httpPost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
          HttpResponse response = httpClient.execute(httpPost);
          HttpEntity entity = response.getEntity();
          is = entity.getContent();
      } catch (Exception e) {
          Log.e("log", "Error in Connection" + e.toString());
          Toast.makeText(getApplicationContext(), "Error in Connection",
                  Toast.LENGTH_SHORT).show();
  
      }
      try {
          BufferedReader reader = new BufferedReader(new InputStreamReader(
                  is, "iso-8859-1"), 8);
          StringBuilder sb = new StringBuilder();
          String line = "";
          while ((line = reader.readLine()) != null) {
              sb.append(line + "\n");
          }
          is.close();
          result = sb.toString();
      } catch (Exception e) {
          // TODO: handle exception
      }
  
      try {
  
          JArray = new JSONObject(result);
          JSONArray jsonArray = JArray.getJSONArray("orders");
  
          for (int i = 0; i &lt; jsonArray.length(); i++) {
              HashMap&lt;String, String&gt; map = new HashMap&lt;String, String&gt;();
              JSONObject jsonObject = jsonArray.getJSONObject(i);
  
              map.put("orders", String.valueOf(i));
              map.put("orderid", jsonObject.getString("orderid"));
              map.put("status", jsonObject.getString("orderstatus"));
  
              mylist.add(map);
          }
      } catch (JSONException e) {
          Toast.makeText(getApplicationContext(), "No Order to Display",
                  Toast.LENGTH_LONG).show();
  
          Log.e("log_tag", "Error parsing data " + e.toString());
      }
      ListAdapter adapter = new SimpleAdapter(this, mylist,
              R.layout.vieworder, new String[] { "orderid", "status" },
              new int[] { R.id.item_title, R.id.item_subtitle });
  
      setListAdapter(adapter);
  
      final ListView lv = getListView();
      lv.setTextFilterEnabled(true);
      lv.setOnItemClickListener(new OnItemClickListener() {
          public final void onItemClick(AdapterView&lt;?&gt; parent, View view,
                  int position, long id) {
              @SuppressWarnings("unchecked")
              HashMap&lt;String, String&gt; o = (HashMap&lt;String, String&gt;) lv
                      .getItemAtPosition(position);
  
              String OrderID = o.get("orderid");
              String OrderStatus = o.get("status");
              Intent intent = new Intent(getApplicationContext(),
                      Din_Ord_ItemDisplay.class);
              intent.putExtra("orderid", OrderID);
              intent.putExtra("waitername", waitername);
              intent.putExtra("orderstatus", OrderStatus);
              intent.putExtra("tableid", tableid1);
              intent.putExtra("url", url);
  
              startActivity(intent);
  
          }
      });
  }
  </code></pre>