title: Sometimes json Array appears with images and sometimes empty array
body: <p>Sometime json array appears with image url's and sometimes it is empty. I am using the following code where array with image url displaying data and image in listview but when array is empty then data is also not displaying. How can i slove this? Any answer will be appreciated</p>
  
  <pre><code>    ArrayList&lt;HashMap&lt;String, String&gt;&gt; songsList = new ArrayList&lt;HashMap&lt;String, String&gt;&gt;();
  
  
      // Creating JSON Parser instance
              JSONParser jParser = new JSONParser();
  
              // getting JSON string from URL
              JSONObject json = jParser.getJSONFromUrl(URL);
              try {
                  JSONArray posts = json.getJSONArray(KEY_POSTS);
  
      // looping through all song nodes &lt;song&gt;
  
              for(int i = 0; i &lt; posts.length(); i++){
                  JSONObject c = posts.getJSONObject(i);
                  // Storing each json item in variable
                  String id = c.getString(KEY_ID);
                  String title = c.getString(KEY_TITLE);
                  String date = c.getString(KEY_DATE);
                  String content = c.getString(KEY_CONTENT);
  
                  //authornumber is agin  JSON Object
                  JSONObject author = c.getJSONObject(KEY_AUTHOR);
                  String name = author.getString(KEY_NAME);
  
  
                  JSONArray atta = c.getJSONArray("attachments");
                  for(int j = 0; j &lt; atta.length(); j++){
                      JSONObject d = atta.getJSONObject(j);
  
                      String slug = d.getString(KEY_SLUG);
  
                      JSONObject images = d.getJSONObject(KEY_IMAGES);
  
                      JSONObject thumbnail = images.getJSONObject(KEY_THUMB_URL);
                      String url = thumbnail.getString(KEY_URL);
  
  
  
          // creating new HashMap
          HashMap&lt;String, String&gt; map = new HashMap&lt;String, String&gt;();
  
          // adding each child node to HashMap key =&gt; value
          map.put(KEY_ID, id);
          map.put(KEY_TITLE, title);
          map.put(KEY_DATE, date);
          map.put(KEY_NAME, name);
          map.put(KEY_CONTENT, content);
          map.put(KEY_SLUG, slug);
          map.put(KEY_URL, url);
  
  
          // adding HashList to ArrayList
          songsList.add(map);
              }   
              } catch (JSONException e) {
                  e.printStackTrace();
  
                  }
  
  
      list=(ListView)findViewById(R.id.list);
  
      // Getting adapter by passing json data ArrayList
      adapter=new LazyAdapter(this, songsList);        
      list.setAdapter(adapter);
  </code></pre>