title: Listview using JSON from RESTApi Android
body: <p>I'm trying to fill a listviews content with JSON Objects obtained from a REST service I've made.</p>
  
  <pre><code>JSONArray users = new JSONArray(result);
  jsonList = users;
  </code></pre>
  
  <p>I retrieve the JSONArray and convert that array into an <code>ArrayList&lt;String&gt;</code>, which I'm using to fill my listview with. </p>
  
  <pre><code>try{
      int length = jsonList.length();
      List&lt;String&gt; contentList = new ArrayList&lt;String&gt;(length);
      for(int i = 0; i &lt; length; i++){
          contentList.add(jsonList.getString(i));
      }
  
      ListView listView = (ListView) findViewById(R.id.listView);
      listView.setAdapter(new ArrayAdapter&lt;String&gt;(this, android.R.layout.simple_list_item_1, contentList));
      } catch(Exception e){
  
      }
  </code></pre>
  
  <p>But when I run the application, there is no data at all in the listview.</p>
  
  <p>I don't really know whether this is a problem because of the way I populate my listview content, or if it's my XML that has some problems.</p>
  
  <p>XML FILES:
  (activity_main.xml)</p>
  
  <pre><code>&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:orientation="vertical"&gt;
  
      &lt;ListView
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:id="@+id/listView" /&gt;
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>I'm a bit of a newcomer when it comes to Android.</p>