title: JSON to listView in android
body: <p>I'm trying to put JSON to <code>ListView</code>. I am getting data from <a href="http://api.androidhive.info/contacts/" rel="nofollow noreferrer">http://api.androidhive.info/contacts/</a> (only using the name field) I am able to get them to <strong>array</strong>, but im unable to put them into the <strong>list</strong>, <br></p>
  
  <p><strong>[NOTE]</strong>
  <em>however the <code>ListView</code> makes exactly 13 lines for 13 entries (number of names) but the lines are blank</em>.</p>
  
  <pre><code>private class GetJidla extends AsyncTask&lt;Void, Void, Void&gt; {
  
      @Override
      protected void onPreExecute() {
          super.onPreExecute();
          // Showing progress dialog
          pDialog = new ProgressDialog(TableMenuActivity.this);
          pDialog.setMessage("Please wait...");
          pDialog.setCancelable(false);
          pDialog.show();
  
      }
  
      @Override
      protected Void doInBackground(Void... arg0) {
          // Creating service handler class instance
          ServiceHandler sh = new ServiceHandler();
  
          // Making a request to url and getting response
          String jsonStr = sh.makeServiceCall(url, ServiceHandler.GET);
  
          Log.d("Response: ", "&gt; " + jsonStr);
  
          if (jsonStr != null) {
              try {
                  JSONObject jsonObj = new JSONObject(jsonStr);
  
                  // Getting JSON Array node
                  jidla = jsonObj.getJSONArray(TAG_CONTACTS);
  
                  // looping through All Contacts
                  for (int i = 0; i &lt; jidla.length(); i++) {
                      JSONObject c = jidla.getJSONObject(i);
  
                    //  String id = c.getString(TAG_ID);
                      String name = c.getString(TAG_NAME);
  
  
                      // tmp hashmap for single contact
                      HashMap&lt;String, String&gt; contact = new HashMap&lt;String, String&gt;();
  
                      // adding each child node to HashMap key =&gt; value
                    //  contact.put(TAG_ID, id);
                      contact.put(TAG_NAME, name);
  
  
                      // adding contact to contact list
                      jidlaList.add(contact);
  
                  }
              } catch (JSONException e) {
                  e.printStackTrace();
              }
          } else {
              Log.e("ServiceHandler", "Couldn't get any data from the url");
          }
  
  
  
          return null;
      }
  
      @Override
      protected void onPostExecute(Void result) {
          super.onPostExecute(result);
          // Dismiss the progress dialog
          if (pDialog.isShowing())
              pDialog.dismiss();
          /**
           * Updating parsed JSON data into ListView
           * */
          ListAdapter adapter = new SimpleAdapter(
                  TableMenuActivity.this, jidlaList,
                  android.R.layout.simple_list_item_1, new String[] {TAG_NAME}, new int[] {android.R.id.list,
                           });
  
          menu = (ListView)findViewById(android.R.id.list);
          menu.setAdapter(adapter); 
  
      } 
  </code></pre>
  
  <p>and the list is here </p>
  
  <pre><code>&lt;ListView
          android:id="@android:id/list"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:layout_marginTop="5dip" &gt;
  
  
  
      &lt;/ListView&gt;
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/GZrRk.png" rel="nofollow noreferrer">i need it to be on one screen, in one activity here is the image, the brown lsit is where i need it</a></p>
  
  <p><img src="https://i.stack.imgur.com/GZrRk.png" alt="Image"></p>