title: Value null of type org.json.JSONObject$1 cannot be converted to JSONArray
body: <p>here is my list View Activity code
  listview:</p>
  
  <pre><code>private static String url = "http://xxx.x.x.xxx/index.php";
  String categ = null;
  private static final String name = "name";
  private static final String Category = "Category";
  
  ListView lv;
  
  String returnString;
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.layout_listview);
  
      Bundle b = getIntent().getExtras();
      categ = b.getString("category_name");
  
      new ProgressTask(ListDataActivity.this).execute();
  
  }
  
  
  class ProgressTask extends AsyncTask&lt;String, Void, Boolean&gt; {
  
      ArrayList&lt;HashMap&lt;String, String&gt;&gt; jsonlist = new ArrayList&lt;HashMap&lt;String, String&gt;&gt;();
  
      ConnectivityManager conMgr = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
      {
          if (conMgr.getActiveNetworkInfo() != null
                  &amp;&amp; conMgr.getActiveNetworkInfo().isAvailable()
                  &amp;&amp; conMgr.getActiveNetworkInfo().isConnected()) {
          } else {
              Toast.makeText(getApplicationContext(),
                      "INTERNET CONNECTION NOT PRESENT", Toast.LENGTH_SHORT)
                      .show();
              startActivity(new Intent(ListDataActivity.this,
                      MainActivity.class));
          }
  
      }
  
      // private List&lt;Message&gt; messages;
      public ProgressTask(ListActivity activity) {
          context = activity;
      }
  
      private Context context;
  
      protected void onPreExecute() {
      }
  
      @Override
      protected void onPostExecute(final Boolean success) {
  
          //Toast.makeText(getApplicationContext(), url, 0).show();
          ListAdapter adapter = new SimpleAdapter(context, jsonlist,
                  R.layout.row_listitem, new String[] { name, Category },
                  new int[] { R.id.vehicleType, R.id.vehicleColor }) {
  
              @Override
              public View getView(int position, View convertView,
                      ViewGroup parent) {
  
                  if (convertView == null) {
  
                      // This a new view we inflate the new layout
  
                      LayoutInflater inflater = (LayoutInflater) context
                              .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  
                      convertView = inflater.inflate(R.layout.row_listitem,
                              null);
                  }
  
                  // TODO Auto-generated method stub
                  if (position % 2 == 1) {
  
                      convertView.setBackgroundColor(Color.rgb(120, 151, 66));
                  } else {
                      convertView.setBackgroundColor(Color.rgb(86, 107, 129));
                  }
                  return super.getView(position, convertView, parent);
              }
          };
  
          setListAdapter(adapter);
  
          lv = getListView();
  
          lv.setOnItemClickListener(new OnItemClickListener() {
              @Override
              public void onItemClick(AdapterView&lt;?&gt; parent, View view,
                      int position, long id) {
  
                  @SuppressWarnings("unchecked")
                  HashMap&lt;String, String&gt; map = (HashMap&lt;String, String&gt;) lv
                          .getItemAtPosition(position);
                  String name = map.get("name");
                  Intent intent = new Intent(ListDataActivity.this,
                          DataViewActivity.class);
                  intent.putExtra("itemName", name);
                  startActivity(intent);
              }
          });
      }
  
      protected Boolean doInBackground(final String... args) {
          url = url + "?cat_name=" + categ;
          Log.d("", url);
  
          baseAdapter jParser = new baseAdapter();
  
          JSONArray json = jParser.getJSONFromUrl(url);
  
          if (json != null) {
              for (int i = 0; i &lt; json.length(); i++) {
  
                  try {
                      JSONObject c = json.getJSONObject(i);
  
                      String vtype = c.getString(name);
                      String vfuel = c.getString(Category);
  
                      HashMap&lt;String, String&gt; map = new HashMap&lt;String, String&gt;();
  
                      // Add child node to HashMap key &amp; value
                      map.put(name, vtype);
                      map.put(Category, vfuel);
  
                      jsonlist.add(map);
                  } catch (JSONException e) {
                      e.printStackTrace();
                  }
              }
          }
          return null;
  
      }
  }
  </code></pre>
  
  <p>base class</p>
  
  <pre><code>public class baseAdapter {
  
  static InputStream iStream = null;
  static JSONArray jarray = null;
  static String json = "";
  
  public baseAdapter() {
  }
  
  public JSONArray getJSONFromUrl(String url) {
  
      StringBuilder builder = new StringBuilder();
      HttpClient client = new DefaultHttpClient();
      HttpGet httpGet = new HttpGet(url);
      try {
          HttpResponse response = client.execute(httpGet);
          StatusLine statusLine = response.getStatusLine();
          int statusCode = statusLine.getStatusCode();
          if (statusCode == 200) {
              HttpEntity entity = response.getEntity();
              InputStream content = entity.getContent();
              BufferedReader reader = new BufferedReader(
                      new InputStreamReader(content));
              String line;
              while ((line = reader.readLine()) != null) {
                  builder.append(line);
              }
          } else {
              Log.e("==&gt;", "Failed to download file");
          }
      } catch (ClientProtocolException e) {
          e.printStackTrace();
      } catch (IOException e) {
          e.printStackTrace();
      }
  
      // Parse String to JSON object
      try {
          jarray = new JSONArray(builder.toString());
      } catch (JSONException e) {
          Log.e("JSON Parser", "Error parsing data " + e.toString());
      }
  
      // return JSON Object
      return jarray;
  
  }
  </code></pre>
  
  <p>my question is i am passing <code>categ</code> from android to php and showing data in list view its working fine but problem is on backpressed when i pass new data to this activity it shows same result in listview on the bases of first data that i passed from previous activity..</p>