title: Android ListView and Volley
body: <p>Very new to android and volley (double trouble :))</p>
  
  <p>After trying the listview with an array of strings(it worked and I was able to see the result) and volley to retrieve from one of those online test api (it worked and I see the result) </p>
  
  <p>When I attempted to combine the two (the response from volley, parse it and pass it to the adapter) and nothing shows.  Would someone kindly point me to some solid tutorial combining volley and listview or help to show me how to get the adapter to display the response correctly in the listview.</p>
  
  <p>Hope someone out there with time to help. </p>
  
  <p>My Mainactivity.java</p>
  
  <pre><code>package com.example.web.listviewexample;
  
  import android.support.v7.app.AppCompatActivity;
  import android.os.Bundle;
  import android.widget.ArrayAdapter;
  import android.widget.ListView;
  import android.widget.TextView;
  
  import com.android.volley.Request;
  import com.android.volley.RequestQueue;
  import com.android.volley.Response;
  import com.android.volley.VolleyError;
  import com.android.volley.toolbox.JsonObjectRequest;
  import com.android.volley.toolbox.Volley;
  
  import org.json.JSONException;
  import org.json.JSONObject;
  
  public class MainActivity extends AppCompatActivity {
      //Array of strings...
      String[] mobileArray = {"Android", "Iphone", "Windows", "WebOs", "BlackBerry", "Max OS x"};
  
      TextView results;
      String JsonURL ="https://reqres.in/api/users/2";
      String data="";
  
      //define the volley request queue. It handles requests
      RequestQueue requestQueue;
  
  
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
  
          //get the listview that will communicate with the adapter
          ListView listexample = (ListView) findViewById(R.id.mobile_list);
          //prepare the adapter
          final ArrayAdapter adapter = new ArrayAdapter&lt;String&gt;(this, android.R.layout.simple_list_item_1);
          //attach the adapter
          listexample.setAdapter(adapter);
  
          //Volley stuff --cricket_007 Stackoverflow.com answer
          final JsonObjectRequest obj= new JsonObjectRequest(Request.Method.GET, JsonURL, new Response.Listener&lt;JSONObject&gt;() {
              @Override
              public void onResponse(JSONObject response) {
                  try {
                      // parse the response
                      response = response.getJSONObject("data");
  
                      // add things to the adapter
                      adapter.add(response.toString());
                  }
                      catch (JSONException e) {
                          e.printStackTrace();
                      }
                  }
              }, new Response.ErrorListener(){
                  @Override
                  public  void onErrorResponse(VolleyError error){error.printStackTrace();
                  }
  
              });
  
         Volley.newRequestQueue(this).add(obj);
          }
      }
  </code></pre>
  
  <p>Activity_Main.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:tools="http://schemas.android.com/tools"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      tools:context=".MainActivity"
      &gt;
  
  
      &lt;ListView
      android:id="@+id/mobile_list"
      android:layout_width="match_parent"
      android:layout_height="wrap_content" &gt;
      &lt;/ListView&gt;
  
  &lt;/LinearLayout
  </code></pre>
  
  <blockquote>
    <p>activity_listview.xml</p>
  </blockquote>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;TextView xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:tools="http://schemas.android.com/tools"
      android:id="@+id/label"
      android:layout_width="fill_parent"
      android:layout_height="fill_parent"
      android:textSize="25sp"
      android:padding="10dp"
      android:textStyle="bold"&gt;
  
  &lt;/TextView&gt;
  </code></pre>
  
  <p>getting this error 
  <a href="https://i.stack.imgur.com/fISsc.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/fISsc.png" alt="enter image description here"></a></p>