image calling using Json format
<p>I can retrieve normal list from the server but when i am trying to set up the image, its producing "Force to close" . The json file can be viewwd <a href="http://midsweden.gofreeserve.com/proj/androidjson.php?identifier=123" rel="nofollow">here</a> .A bundle of Thanks in advance. Here is the code.</p>

<pre><code>public class Test extends ListActivity  {
      Prefs myprefs = null;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.listplaceholder);
        this.myprefs = new Prefs(getApplicationContext());
        // install handler for processing gui update messages
        ArrayList&lt;HashMap&lt;String, Object&gt;&gt; mylist = new ArrayList&lt;HashMap&lt;String, Object&gt;&gt;(); 
       JSONObject json = JSONfunctions.getJSONfromURL("http://midsweden.gofreeserve.com/proj/androidjson.php?identifier=" + 
        Test.this.myprefs.getPersonalno());

        try{

            JSONArray  earthquakes = json.getJSONArray("services");

            for(int i=0;i&lt;earthquakes.length();i++){                        
                HashMap&lt;String, Object&gt; map = new HashMap&lt;String, Object&gt;();
                 JSONObject e = earthquakes.getJSONObject(i);

                map.put("id", e.getString("taskid"));
                map.put("pic", "Service name : " + e.getString("employeepic"));
                map.put("serviceinfo", "" +  e.getString("employeename")+ " : "+ e.getString("starttime")
                        +" To " +  e.getString("endtime"));
                  ImageView imgView=(ImageView)findViewById(R.id.image);
                 String imageBaseDirectory = "http://midsweden.gofreeserve.com/proj/admin/pictures";
                 String imageName = e.getString("employeepic");
                 imgView.setImageURI(Uri.parse(imageBaseDirectory+imageName));
                    map.put("img",imageName);
                mylist.add(map);            
            }       
        }catch(JSONException e)        {
             Log.e("log_tag", "Error parsing data "+e.toString());
        }

        SimpleAdapter adapter = new SimpleAdapter(this, mylist , R.layout.test,new String[] {"img", "servicename", "serviceinfo" }, 
                        new int[] {  R.id.image ,R.id.item_title, R.id.item_subtitle });

        setListAdapter(adapter);

        final ListView lv = getListView();
        lv.setTextFilterEnabled(true);  
        lv.setOnItemClickListener(new OnItemClickListener() {
            public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) {              
                @SuppressWarnings("unchecked")
                HashMap&lt;String, String&gt; o = (HashMap&lt;String, String&gt;) lv.getItemAtPosition(position);                   
                Toast.makeText(Test.this, "ID '" + o.get("id") + "' was clicked.", Toast.LENGTH_SHORT).show(); 

            }
        });

    }
</code></pre>

<p>Here is the xml 
</p>

<pre><code>&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:cacheColorHint="#55000000"
    android:background="#55000000"
    &gt;
      &lt;ImageView
      android:id="@+id/image"
      android:layout_width="50dip"
      android:layout_height="50dip"
       android:scaleType="centerCrop"/&gt;
&lt;TextView  

    android:id="@+id/item_title"
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:textAppearance="?android:attr/textAppearanceMedium"
    android:padding="2dp"
    android:textSize="20dp" /&gt;
    &lt;TextView  
    android:id="@+id/item_subtitle"
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:padding="2dp"
    android:textSize="18dp" /&gt;
&lt;/LinearLayout&gt;
</code></pre>

<p>Here is the logcat </p>

<pre><code>07-06 01:09:18.409: WARN/dalvikvm(101): disableGcForExternalAlloc: true
07-06 01:09:18.409: INFO/ActivityManager(101): Starting activity: Intent { cmp=com.droidnova.android.howto.optionmenu/.Test }
07-06 01:09:18.449: WARN/dalvikvm(101): disableGcForExternalAlloc: false
07-06 01:09:19.009: DEBUG/dalvikvm(16327): GC freed 2412 objects / 190240 bytes in 105ms
07-06 01:09:20.829: DEBUG/ImagesWidgetProvider(16291): OnReceive:Action: android.appwidget.action.APPWIDGET_UPDATE
07-06 01:09:20.829: DEBUG/ImagesWidgetProvider(16291): onUpdate(): 
07-06 01:09:21.329: DEBUG/AndroidRuntime(16327): Shutting down VM
07-06 01:09:21.329: WARN/dalvikvm(16327): threadid=3: thread exiting with uncaught exception (group=0x4001e390)
07-06 01:09:21.329: ERROR/AndroidRuntime(16327): Uncaught handler: thread main exiting due to uncaught exception
07-06 01:09:21.339: ERROR/AndroidRuntime(16327): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.droidnova.android.howto.optionmenu/com.droidnova.android.howto.optionmenu.Test}: java.lang.NullPointerException
07-06 01:09:21.339: ERROR/AndroidRuntime(16327):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2596)
07-06 01:09:21.339: ERROR/AndroidRuntime(16327):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2621)
07-06 01:09:21.339: ERROR/AndroidRuntime(16327):     at android.app.ActivityThread.access$2200(ActivityThread.java:126)
07-06 01:09:21.339: ERROR/AndroidRuntime(16327):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1932)
07-06 01:09:21.339: ERROR/AndroidRuntime(16327):     at android.os.Handler.dispatchMessage(Handler.java:99)
07-06 01:09:21.339: ERROR/AndroidRuntime(16327):     at android.os.Looper.loop(Looper.java:123)
07-06 01:09:21.339: ERROR/AndroidRuntime(16327):     at android.app.ActivityThread.main(ActivityThread.java:4595)
07-06 01:09:21.339: ERROR/AndroidRuntime(16327):     at java.lang.reflect.Method.invokeNative(Native Method)
07-06 01:09:21.339: ERROR/AndroidRuntime(16327):     at java.lang.reflect.Method.invoke(Method.java:521)
07-06 01:09:21.339: ERROR/AndroidRuntime(16327):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
07-06 01:09:21.339: ERROR/AndroidRuntime(16327):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
07-06 01:09:21.339: ERROR/AndroidRuntime(16327):     at dalvik.system.NativeStart.main(Native Method)
07-06 01:09:21.339: ERROR/AndroidRuntime(16327): Caused by: java.lang.NullPointerException
07-06 01:09:21.339: ERROR/AndroidRuntime(16327):     at com.droidnova.android.howto.optionmenu.Test.onCreate(Test.java:56)
07-06 01:09:21.339: ERROR/AndroidRuntime(16327):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
07-06 01:09:21.339: ERROR/AndroidRuntime(16327):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2544)
</code></pre>
