Retrieving a JSON array from an Android application
<p>I manage to retrieve Json content from the URL: <a href="http://twitter.com/statuses/public_timeline.json" rel="nofollow">http://twitter.com/statuses/public_timeline.json</a>
Which provide just tweets. Now I want to retrieve another JSON array from another URL, which has the follwoing format:</p>

<pre><code>  {
"contacts": [
    {
            "id": "c200",
            "name": "Ravi Tamada",
            "email": "ravi@gmail.com",
            "address": "xx-xx-xxxx,x - street, x - country",
            "gender" : "male",
    },
    {
            "id": "c201",
            "name": "Johnny Depp",
            "email": "johnny_depp@gmail.com",
            "address": "xx-xx-xxxx,x - street, x - country",
            "gender" : "male",

    },
    .
    .
}
</code></pre>

<p>The diference as you can verify is that the one JSON array has a name and the second not. The code that I was used for the tweet retrieving, was the following one:</p>

<pre><code>  private class LoadListTask extends AsyncTask&lt;Void, Tweet, Void&gt; {

    private final ProgressDialog pd = new ProgressDialog(TweetTestActivity.this);

      // can use UI thread here
      @SuppressWarnings("unchecked")
    protected void onPreExecute() {
          ((ArrayAdapter&lt;String&gt;)getListAdapter()).clear();
         this.pd.setMessage("Loading List...");
         this.pd.show();
      }

    protected Void doInBackground(Void... ars) {
         // TODO    4 new activity with custom adapter to show schedules
         try {
            HttpClient client = new DefaultHttpClient();
            HttpGet get = new HttpGet("http://twitter.com/statuses/public_timeline.json");

            ResponseHandler&lt;String&gt; responseHandler = new BasicResponseHandler();

            JSONArray ja = new JSONArray(client.execute(get, responseHandler));

            for (int i = 0; i &lt; ja.length(); i++) {
                 JSONObject jo = (JSONObject) ja.get(i);
                 publishProgress(new Tweet(jo.getString("id_str"),jo.getString("text")));
            }
         } catch (IOException e) {
             e.printStackTrace();
         } catch (JSONException e) {
             e.printStackTrace();
         } catch (Exception e) {
             e.printStackTrace();
        }

         return null;
     }

     @SuppressWarnings("unchecked")
    protected void onProgressUpdate(Tweet... progress) {
         ((ArrayAdapter&lt;Tweet&gt;)getListAdapter()).add(progress[0]);
         }

     protected void onPostExecute(Void result) {
         pd.dismiss();
     }
 }
</code></pre>

<p>Question: What changes should i perform to retrieve the contacts array? Because when i just change the id_str to gender(and the URL of course) i take an error which says: org.json.JSONException: No value for gender.</p>
