title: imageloader error in place of url[position]
body: <p>I am using imageloader to load thumbnail images from json response, there are lots of images obtained from json response need to parse that and place images in listview. I am getting confuse what to add in place of <code>url[position]</code> getting error in  <code>imgLoader.DisplayImage(url[position], loader, image);</code> any one help me to find solution it would be a great help for me and your answer will be appreciated. thank you in advance.</p>
  
  <p>following is the code and json response:</p>
  
  <pre><code>   public class AndroidLoadImageFromURLActivity extends ListActivity {
  
      // url to make request
     private static String desi = "http://website";
  
     // JSON Node names
     private static final String TAG_POSTS = "posts";
     private static final String TAG_ID = "id";
     private static final String TAG_TITLE = "title";
     private static final String TAG_DATE = "date";
     private static final String TAG_CONTENT = "content";
     private static final String TAG_AUTHOR = "author";
     private static final String TAG_NAME = "name";
     private static final String TAG_ATTACHMENTS = "attachments";
     private static final String TAG_IMAGES = "images";
     private static final String TAG_THUMBNAIL = "thumbnail";
     private static final String TAG_URL = "url";
  
     // contacts JSONArray
     JSONArray posts = null;
  
  
        @Override
          public void onCreate(Bundle savedInstanceState) {
           super.onCreate(savedInstanceState);
            setContentView(R.layout.list_item);
  
          // Hashmap for ListView
      ArrayList&lt;HashMap&lt;String, String&gt;&gt; contactList = 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(desi);
  
      try {
          // Getting Array of Contacts
          posts = json.getJSONArray(TAG_POSTS);
  
          // looping through All Contacts
          for(int i = 0; i &lt; posts.length(); i++){
              JSONObject c = posts.getJSONObject(i);
  
              // Storing each json item in variable
              String id = c.getString(TAG_ID);
              String title = c.getString(TAG_TITLE);
              String date = c.getString(TAG_DATE);
              String content = c.getString(TAG_CONTENT);
              // to remove all &lt;P&gt; &lt;/p&gt; and &lt;br /&gt; and replace with ""
               content = content.replace("&lt;br /&gt;", "");
               content = content.replace("&lt;p&gt;", "");
               content = content.replace("&lt;/p&gt;", "");
  
              // Author is agin  JSON Object
              JSONObject author = c.getJSONObject(TAG_AUTHOR);
              String name = author.getString(TAG_NAME);
  
              JSONArray attachments = json.getJSONArray(TAG_ATTACHMENTS);
  
              for(int j = 0; j &lt; attachments.length(); j++){
                  JSONObject d = attachments.getJSONObject(i);
  
  
              JSONObject thumbnail = d.getJSONObject(TAG_THUMBNAIL);
              String url = thumbnail.getString(TAG_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(TAG_ID, id);
              map.put(TAG_TITLE, title);
              map.put( TAG_DATE, date);
              map.put( TAG_NAME, name);
              map.put( TAG_CONTENT, content);
              // adding HashList to ArrayList
              contactList.add(map);
          }   
      } catch (JSONException e) {
          e.printStackTrace();
      }
  
  
      /**
       * Updating parsed JSON data into ListView
       * */
      ListAdapter adapter = new SimpleAdapter(this, contactList,
              R.layout.list_row,
              new String[] { TAG_TITLE, TAG_DATE, TAG_NAME, TAG_CONTENT, TAG_URL },
          new int[] { R.id.name, R.id.email,R.id.mobile, R.id.content, R.id.list_image});
  
      setListAdapter(adapter);
  
            // Loader image - will be shown before loading image
             int loader = R.drawable.loader;
  
               // Imageview to show
            ImageView image = (ImageView) findViewById(R.id.list_image);
  
  
      // ImageLoader class instance
       ImageLoader imgLoader = new ImageLoader(getApplicationContext());
  
  
      // whenever you want to load an image from url
      // call DisplayImage function
      // url - image url to load
      // loader - loader image, will be displayed before getting image
      // image - ImageView 
      imgLoader.DisplayImage(url[position], loader, image);
      }
       }
  </code></pre>
  
  <p>JSON response</p>
  
  <pre><code>{
  "status": "ok",
  
  "posts": [
      {
          "id": 2498,
          "title": "jigsaw lamp imported from thailand",
          "content": "&lt;p&gt;Hi. It&amp;#8217;s a invitation to have a look at a unique lamp shade called jigsaw lamp from thailand. Available in multi attractive colours.&lt;/p&gt;\n",
          "date": "2012-12-26 09:48:15",
           "author": {
              "name": "Tapas123456",
                          },
              "attachments": [
              {
                  "description": "",
                  "caption": "",
                  "mime_type": "image/jpeg",
                  "images": {
  
                      "thumbnail": {
                          "url": "http://site/wp-content/uploads/2012/12/646675-50x47.jpg",
  
                      }
                  }
              },...............
  </code></pre>
  
  <p>logcat error</p>
  
  <pre><code>12-26 16:53:26.154: E/AndroidRuntime(330): FATAL EXCEPTION: main
  12-26 16:53:26.154: E/AndroidRuntime(330): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.androidhive.imagefromurl/com.androidhive.imagefromurl.AndroidLoadImageFromURLActivity}: java.lang.RuntimeException: Your content must have a ListView whose id attribute is 'android.R.id.list'
  12-26 16:53:26.154: E/AndroidRuntime(330):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
  12-26 16:53:26.154: E/AndroidRuntime(330):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
  12-26 16:53:26.154: E/AndroidRuntime(330):  at android.app.ActivityThread.access$2300(ActivityThread.java:125)
  12-26 16:53:26.154: E/AndroidRuntime(330):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
  12-26 16:53:26.154: E/AndroidRuntime(330):  at android.os.Handler.dispatchMessage(Handler.java:99)
  12-26 16:53:26.154: E/AndroidRuntime(330):  at android.os.Looper.loop(Looper.java:123)
  12-26 16:53:26.154: E/AndroidRuntime(330):  at android.app.ActivityThread.main(ActivityThread.java:4627)
  12-26 16:53:26.154: E/AndroidRuntime(330):  at java.lang.reflect.Method.invokeNative(Native Method)
  12-26 16:53:26.154: E/AndroidRuntime(330):  at java.lang.reflect.Method.invoke(Method.java:521)
  12-26 16:53:26.154: E/AndroidRuntime(330):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
  12-26 16:53:26.154: E/AndroidRuntime(330):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
  12-26 16:53:26.154: E/AndroidRuntime(330):  at dalvik.system.NativeStart.main(Native Method)
  12-26 16:53:26.154: E/AndroidRuntime(330): Caused by: java.lang.RuntimeException: Your content must have a ListView whose id attribute is 'android.R.id.list'
  12-26 16:53:26.154: E/AndroidRuntime(330):  at android.app.ListActivity.onContentChanged(ListActivity.java:245)
  12-26 16:53:26.154: E/AndroidRuntime(330):  at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:201)
  12-26 16:53:26.154: E/AndroidRuntime(330):  at android.app.Activity.setContentView(Activity.java:1647)
  12-26 16:53:26.154: E/AndroidRuntime(330):  at com.androidhive.imagefromurl.AndroidLoadImageFromURLActivity.onCreate(AndroidLoadImageFromURLActivity.java:44)
  12-26 16:53:26.154: E/AndroidRuntime(330):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
  12-26 16:53:26.154: E/AndroidRuntime(330):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
  </code></pre>