title: fetch url links from json and add to listview
body: <p>I'm trying to get url links of images from json response, save it to string[] using ArrayList and then display the images in gridview as shown in this <a href="https://futurestud.io/blog/picasso-adapter-use-for-listview-gridview-etc" rel="nofollow noreferrer">site</a>. My json looks like this:<a href="https://i.stack.imgur.com/0HGJS.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/0HGJS.png" alt="enter image description here"></a></p>
  
  <p>I fetched the links using volley but I'm not getting the links properly. I checked the content of ArrayList using Toast and it shows the images inside [[]] like this:<a href="https://i.stack.imgur.com/A1Cd8.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/A1Cd8.jpg" alt="enter image description here"></a></p>
  
  <p>That's why the images are not getting downloaded. I get 6 blank views in list. </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="false" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>MainActivity:
  
  public class MainActivity extends AppCompatActivity {
  
  
      String[] IMGS={};
      ArrayList&lt;String&gt; sal = new ArrayList&lt;String&gt;();
      ListView listView;
      public static final String KEY_USERID = "user_id";
      private static final String REGISTER_URL = "http://example.com/Services.php?action=fetchUserLog";
  
  
  
  
      @Override
      protected void onCreate(Bundle savedInstanceState){
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
  
  
          registerUser();
          listView = (ListView)findViewById(R.id.list);
  
  
      }
  
  /////////////////////////////////////////  Volley Method Starts //////////////////////////////////////////////////////////////////
  
      private void registerUser(){
  
          StringRequest stringRequest = new StringRequest(Request.Method.POST, REGISTER_URL,
                  new Response.Listener&lt;String&gt;() {
                      @Override
                      public void onResponse(String response) {
  
                          //Toast.makeText(MainActivity.this,response,Toast.LENGTH_LONG).show();
                          try {
                              JSONObject jObj = new JSONObject(response);
                              String status = jObj.getString("status");
                              Toast.makeText(MainActivity.this, status, Toast.LENGTH_LONG).show();
  
  
                              // Now check status value
                              if (status.equals("0")) {
  
                                  Toast.makeText(MainActivity.this, "There was some error! Please try again.", Toast.LENGTH_LONG).show();
  
                              }else if(status.equals("1")){
  
                                  // Toast.makeText(getActivity(), "Information saved successfully", Toast.LENGTH_LONG).show();
  
  
                                  JSONArray result = jObj.getJSONArray("results");
                                  for(int i = 0 ; i &lt; result.length() ; i++){
                                      JSONObject json_data = result.getJSONObject(i);
                                      sal.add(json_data.getString("images"));
                                      //Toast.makeText(MainActivity.this, sal+"", Toast.LENGTH_LONG).show();
                                      IMGS = sal.toArray(new String[sal.size()]);
  
                                      listView.setAdapter(new ImageListAdapter(MainActivity.this, IMGS));
  
                                  }
  
  
  
                              } else {
                                  // Error in login. Get the error message
                                  String errorMsg = jObj.getString("error_msg");
                                  Toast.makeText(MainActivity.this, errorMsg, Toast.LENGTH_LONG).show();
                              }
                          } catch (JSONException e) {
                              // JSON error
                              e.printStackTrace();
                              Toast.makeText(MainActivity.this, "Json error: " + e.getMessage(), Toast.LENGTH_LONG).show();
                          }
  
  
  
                      }
                  },
                  new Response.ErrorListener() {
                      @Override
                      public void onErrorResponse(VolleyError error) {
                          Toast.makeText(MainActivity.this, error.toString(), Toast.LENGTH_LONG).show();
                      }
                  }){
              @Override
              protected Map&lt;String,String&gt; getParams(){
                  Map&lt;String,String&gt; params = new HashMap&lt;String, String&gt;();
                  params.put(KEY_USERID, "21");
                  return params;
              }
  
          };
  
          RequestQueue requestQueue = Volley.newRequestQueue(this);
          requestQueue.add(stringRequest);
      }
  
  /////////////////////////////////////////  Volley Method Ends ////////////////////////////////////////////////////////////////////
  
  
  
  }</code></pre>
  </div>
  </div>
  </p>