title: Parse JSON Array rather than JSON Object
body: <p>any help would be much appreciated...</p>
  
  <p>I am fairly new to android and java. I have previously built an app which parses a JSON array within a JSON Object to a listview. What I need to do in my new app is to parse a JSON array that is not contained in a JSON object and I am having trouble figuring out how to adapt my code.</p>
  
  <pre><code>Java Activity:
  public class StationListActivity  extends AppCompatActivity {
  
  
  ListView mainListView;
  JSONAdapter mJSONAdapter;
  
  
  
  private static final String QUERY_URL = "url.json";
  ProgressDialog mDialog;
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_station_list);
  
  
  
  
      // Access the ListView
      mainListView = (ListView) findViewById(R.id.list);
  
  
      // Create a JSONAdapter for the ListView
      mJSONAdapter = new JSONAdapter(this, getLayoutInflater());
  
      // Set the ListView to use the ArrayAdapter
      mainListView.setAdapter(mJSONAdapter);
  
      mDialog = new ProgressDialog(this);
      mDialog.setMessage("Searching");
      mDialog.setCancelable(false);
  
      // Create a client to perform networking
      AsyncHttpClient client = new AsyncHttpClient();
  
      // Show ProgressDialog to inform user that a task in the background is     occurring
      mDialog.show();
  
  
  
  
      // Have the client get a JSONArray of data
      // and define how to respond
      client.get(QUERY_URL, new JsonHttpResponseHandler() {
  
                  @Override
                  public void onSuccess(JSONObject jsonObject) {
  
                      // Dismiss the ProgressDialog
                      mDialog.dismiss();
  
                      // update the data in your custom method.
                      mJSONAdapter.updateData(jsonObject.optJSONArray("-Here I     would have JSON Object name which contained JSON Array-"));
                  }
  
                  @Override
                  public void onFailure(int statusCode, Throwable throwable,     JSONObject error) {
  
                      // Dismiss the ProgressDialog
                      mDialog.dismiss();
  
                      // Display a "Toast" message
                      // to announce the failure
                      Toast.makeText(getApplicationContext(), "Network error,     please close app and try again", Toast.LENGTH_LONG).show();
  
                      // Log error message
                      // to help solve any problems
                      Log.e("applog", statusCode + " " +     throwable.getMessage());
                  }
              }
      );
  
  }
  </code></pre>
  
  <p>Example JSON:</p>
  
  <pre><code>[
      {
      "name": "Silver", 
      "id": 12, 
      "number": 34
      }
  ]
  </code></pre>
  
  <p>.
  .
  .</p>
  
  <p>Example JSON I know how to work with:</p>
  
  <pre><code>{"title":
      [
          {
          "name": "Silver", 
          "id": 12, 
          "number": 34
          }
      ]
  }
  </code></pre>
  
  <p>It may not be the cleanest solution but would it be possible to add some java to assign the retrieved JSON to a JSON object as in my second example?</p>