dynamic lazylist
<p>Hello everyone i want to make <a href="http://stackoverflow.com/questions/541966/android-how-do-i-do-a-lazy-load-of-images-in-listview/3068012#3068012">this</a> Lazylist dynamic . i have tried with images first buts its coming with force to close . Please guide if my approach is wrong.
Here is code </p>

<pre><code>public class Test extends Activity {

    ListView list;
    LazyAdapter adapter;
    private String[] mStrings;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);



        ArrayList&lt;String&gt; listItems = new ArrayList&lt;String&gt;();
        try {
            URL twitter = new URL(
                    "http://midsweden.gofreeserve.com/proj/androidjson.php?identifier=123");
            URLConnection tc = twitter.openConnection();
            BufferedReader in = new BufferedReader(new InputStreamReader(
                    tc.getInputStream()));

            String line;
            while ((line = in.readLine()) != null) {
                JSONArray ja = new JSONArray(line);

                for (int i = 0; i &lt; ja.length(); i++) {
                    JSONObject jo = (JSONObject) ja.get(i);
                    listItems.add(jo.getString("http://midsweden.gofreeserve.com/proj/admin/pictures/file87619.jpg"));
                }
            }
        } catch (MalformedURLException e) {
            // TODO Auto-generated catch block
            e.printStackTrace(); 
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (JSONException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();

        }

        mStrings = listItems.toArray(new String[listItems.size()]);
         list=(ListView)findViewById(R.id.list);

        adapter=new LazyAdapter(this, mStrings);
         list.setAdapter(adapter);

         Button b=(Button)findViewById(R.id.button1);
         b.setOnClickListener(listener);
        }
    @Override
    public void onDestroy()
    {
        adapter.imageLoader.stopThread();
        list.setAdapter(null);
        super.onDestroy();
    }

    public OnClickListener listener=new OnClickListener(){
        public void onClick(View arg0) {
            adapter.imageLoader.clearCache();
            adapter.notifyDataSetChanged();
        }
    };




}
</code></pre>

<p>logcat</p>

<pre><code>07-09 01:00:51.825: WARN/dalvikvm(12674): threadid=3: thread exiting with uncaught exception (group=0x4001e390)
07-09 01:00:51.835: ERROR/AndroidRuntime(12674): Uncaught handler: thread main exiting due to uncaught exception
07-09 01:00:51.865: ERROR/AndroidRuntime(12674): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.droidnova.android.howto.optionmenu/com.droidnova.android.howto.optionmenu.Test}: java.lang.NullPointerException
07-09 01:00:51.865: ERROR/AndroidRuntime(12674):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2596)
07-09 01:00:51.865: ERROR/AndroidRuntime(12674):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2621)
07-09 01:00:51.865: ERROR/AndroidRuntime(12674):     at android.app.ActivityThread.access$2200(ActivityThread.java:126)
07-09 01:00:51.865: ERROR/AndroidRuntime(12674):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1932)
07-09 01:00:51.865: ERROR/AndroidRuntime(12674):     at android.os.Handler.dispatchMessage(Handler.java:99)
07-09 01:00:51.865: ERROR/AndroidRuntime(12674):     at android.os.Looper.loop(Looper.java:123)
07-09 01:00:51.865: ERROR/AndroidRuntime(12674):     at android.app.ActivityThread.main(ActivityThread.java:4595)
07-09 01:00:51.865: ERROR/AndroidRuntime(12674):     at java.lang.reflect.Method.invokeNative(Native Method)
07-09 01:00:51.865: ERROR/AndroidRuntime(12674):     at java.lang.reflect.Method.invoke(Method.java:521)
07-09 01:00:51.865: ERROR/AndroidRuntime(12674):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
07-09 01:00:51.865: ERROR/AndroidRuntime(12674):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
07-09 01:00:51.865: ERROR/AndroidRuntime(12674):     at dalvik.system.NativeStart.main(Native Method)
07-09 01:00:51.865: ERROR/AndroidRuntime(12674): Caused by: java.lang.NullPointerException
07-09 01:00:51.865: ERROR/AndroidRuntime(12674):     at com.droidnova.android.howto.optionmenu.LazyAdapter.getCount(LazyAdapter.java:27)
07-09 01:00:51.865: ERROR/AndroidRuntime(12674):     at android.widget.ListView.setAdapter(ListView.java:431)
07-09 01:00:51.865: ERROR/AndroidRuntime(12674):     at com.droidnova.android.howto.optionmenu.Test.onCreate(Test.java:35)
07-09 01:00:51.865: ERROR/AndroidRuntime(12674):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
07-09 01:00:51.865: ERROR/AndroidRuntime(12674):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2544)
07-09 01:00:51.865: ERROR/AndroidRuntime(12674):     ... 11 more
07-09 01:00:51.895: INFO/Process(82): Sending signal. PID: 12674 SIG: 3
07-09 01:00:51.895: INFO/dalvikvm(12674): threadid=7: reacting to signal 3
</code></pre>
