title: How to update listview after changing data in JSON?
body: <p>Hello everyone and happy new year</p>
  
  <p>I have JSON class where I retrieve some data that are retrieve from a database. The format of this JSON file is </p>
  
  <pre><code>{"people":[{"id":"15","first_name":"Theo","last_name":"Tziomakas","bio":"Hello from 
  Theo!!!","created":"2015-01-11 21:48:51"},
  {"id":"16","first_name":"Jim","last_name":"Chytas","bio":"Hello from Chytas","created":"2015-01-11 
  21:53:42"}]}.
  </code></pre>
  
  <p>The idea is to retrieve the "first_name" and "second_name" in a listview. The "bio" should appear in another activity,but I don't know how to do that:(.</p>
  
  <p>Here is my code. </p>
  
  <pre><code> public class MainActivity extends ActionBarActivity {
   ListView list;
   TextView fname;
  TextView lname;
  
  
   ArrayList&lt;HashMap&lt;String, String&gt;&gt; oslist = new ArrayList&lt;HashMap&lt;String, String&gt;&gt;();
  //URL to get JSON Array
  private static String url = "http://xxxxxxx/tutorials/index.php";
  //JSON Node Names
  private static final String TAG_OS = "people";
  private static final String TAG_FIRST_NAME = "first_name";
  private static final String TAG_SECOND_NAME = "last_name";
  //private static final String TAG_BIO = "bio";
  JSONArray android = null;
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
      oslist = new ArrayList&lt;HashMap&lt;String, String&gt;&gt;();
  
  
              new JSONParse().execute();
          }
  
  
  private class JSONParse extends AsyncTask&lt;String, String, JSONObject&gt; {
      private ProgressDialog pDialog;
      @Override
      protected void onPreExecute() {
          super.onPreExecute();
          fname = (TextView)findViewById(R.id.first_name);
          lname = (TextView)findViewById(R.id.last_name);
          //abio = (TextView)findViewById(R.id.bio);
  
          pDialog = new ProgressDialog(MainActivity.this);
          pDialog.setMessage("Getting Data ...");
          pDialog.setIndeterminate(false);
          pDialog.setCancelable(true);
          pDialog.show();
      }
      @Override
      protected JSONObject doInBackground(String... args) {
          JSONParser jParser = new JSONParser();
          // Getting JSON from URL
          JSONObject json = jParser.getJSONFromUrl(url);
          return json;
      }
      @Override
      protected void onPostExecute(JSONObject json) {
          pDialog.dismiss();
          try {
              // Getting JSON Array from URL
              android = json.getJSONArray(TAG_OS);
              for(int i = 0; i &lt; android.length(); i++){
                  JSONObject c = android.getJSONObject(i);
                  // Storing  JSON item in a Variable
                  String first_name = c.getString(TAG_FIRST_NAME);
                  String last_name = c.getString(TAG_SECOND_NAME);
                  //String bio = c.getString(TAG_BIO);
                  // Adding value HashMap key =&gt; value
                  HashMap&lt;String, String&gt; map = new HashMap&lt;String, String&gt;();
                  map.put(TAG_FIRST_NAME, first_name);
                  map.put(TAG_SECOND_NAME, last_name);
                  //map.put(TAG_BIO, bio);
                  oslist.add(map);
                  list=(ListView)findViewById(R.id.list);
                  ListAdapter adapter = new SimpleAdapter(MainActivity.this, oslist,
                          R.layout.list_v,
                          new String[] { TAG_FIRST_NAME,TAG_SECOND_NAME }, new int[] {
                          R.id.first_name,R.id.last_name});
                  list.setAdapter(adapter);
                  list.setOnItemClickListener(new AdapterView.OnItemClickListener() {
                      @Override
                      public void onItemClick(AdapterView&lt;?&gt; parent, View view,
                                              int position, long id) {
                          String bio = ((TextView) view.findViewById(R.id.bio))
                                  .getText().toString();
                          switch (position) {
                              case 0:
  
                              Intent i = new Intent(MainActivity.this, SingleActivity.class);
                              i.putExtra("bio", bio);
                              startActivity(i);
                              break;
                          }
                      }
                  });
              }
          } catch (JSONException e) {
              e.printStackTrace();
          }
       }
    }
  }
  </code></pre>
  
  <p>And finally I have the SecondActivity class,but nothing is shown when I click the first row of list.</p>
  
  <pre><code> public class SingleActivity extends ActionBarActivity {
   TextView text;
   JSONArray android = null;
   @Override
   protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_single);
  
      text = (TextView)findViewById(R.id.text);
      String bio = getIntent().getStringExtra("bio");
  
      try {
          JSONObject profileJSON = new JSONObject(bio);
          android = profileJSON.getJSONArray(bio);
          text.setText(""+android);
      } catch (JSONException e) {
          e.printStackTrace();
      }
  
  
    }
  }
  </code></pre>
  
  <p>Thank you.</p>
  
  <p>EDIT:The problem I had is fixed. Now I want to do something else. Let us suppose that we update the data in an existing row by changing "first_name,"last_name" and finally bio. It is done very easily in phpmyadmin tool. The problem is that the updated row is not shown in the listview. I have to reinstall the app in order to see it. Any ideas in that?</p>