title: Android asynctask on listview
body: <p>so I have a problem populating a listActivity during the onPostExecute method.
  The result list of SingleData is correct... Then I use a custom adapter to bind to the android.R.id.list...</p>
  
  <p>but it gives me error... and I really don't understand why... 
  so here's the code of the adapter.. :</p>
  
  <pre><code>private class RequestAdapter extends ArrayAdapter&lt;SingleData&gt; {
  
      private int _resource;
      private LayoutInflater _inflater;
      private Context _context;
  
      public RequestAdapter(Context context, int textViewResourceId,
              List&lt;SingleData&gt; objects) {
          super(context, textViewResourceId, objects);
          _resource = textViewResourceId;
          _context = context;
          _inflater = LayoutInflater.from(_context);
      }
  
      @Override
      public View getView(int position, View convertView, ViewGroup parent) {
  
          convertView = (ListView)_inflater.inflate(_resource,null);
          SingleData sdd = getItem(position);
  
          ImageView iv = (ImageView)convertView.findViewById(R.id.imagePlaceHolder_IV);
          iv.setImageBitmap(sdd.thumbIMG);
  
          TextView tv = (TextView)convertView.findViewById(R.id.createdAt_TV);
          tv.setText(sdd.timeStamp);
  
          // TODO Auto-generated method stub
          return convertView;         
      }
  
  }
  </code></pre>
  
  <p>and here is the onPostExecute:</p>
  
  <pre><code>private class DownloadTheImages extends AsyncTask&lt;Void, Void, List&lt;SingleData&gt;&gt; {
  
      private Context _ctx;
  
      public DownloadTheImages(Context ctx) {
          _ctx = ctx;
      }
  
       protected void onPostExecute(List&lt;SingleData&gt; result) {             
  
           ListView mainLV = (ListView)findViewById(android.R.id.list);
           mainLV.setAdapter(new RequestAdapter(_ctx, R.layout.single_row, result));
  
       }
  
      protected List&lt;SingleData&gt; doInBackground(Void... params) {
                ..... 
               ....
                }
         }
  </code></pre>
  
  <p>and the LOGCAT:</p>
  
  <pre><code>10-20 15:02:55.166: E/AndroidRuntime(761): FATAL EXCEPTION: main
  10-20 15:02:55.166: E/AndroidRuntime(761): java.lang.NullPointerException
  10-20 15:02:55.166: E/AndroidRuntime(761):  at com.mimiedesign.dingle.PictureStreamViewer$DownloadTheImages.onPostExecute(PictureStreamViewer.java:103)
  10-20 15:02:55.166: E/AndroidRuntime(761):  at com.mimiedesign.dingle.PictureStreamViewer$DownloadTheImages.onPostExecute(PictureStreamViewer.java:1)
  10-20 15:02:55.166: E/AndroidRuntime(761):  at android.os.AsyncTask.finish(AsyncTask.java:417)
  10-20 15:02:55.166: E/AndroidRuntime(761):  at android.os.AsyncTask.access$300(AsyncTask.java:127)
  10-20 15:02:55.166: E/AndroidRuntime(761):  at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:429)
  </code></pre>
  
  <p>any clue?... thanks.. </p>
  
  <p>THESE ARE THE NEWER ERRORS:</p>
  
  <pre><code>10-20 16:32:56.615: E/AndroidRuntime(1487):     at android.widget.AbsListView.obtainView(AbsListView.java:1430)
  10-20 16:32:56.615: E/AndroidRuntime(1487):     at android.widget.ListView.makeAndAddView(ListView.java:1745)
  10-20 16:32:56.615: E/AndroidRuntime(1487):     at android.widget.ListView.fillDown(ListView.java:670)
  10-20 16:32:56.615: E/AndroidRuntime(1487):     at android.widget.ListView.fillFromTop(ListView.java:727)
  10-20 16:32:56.615: E/AndroidRuntime(1487):     at android.widget.ListView.layoutChildren(ListView.java:1598)
  10-20 16:32:56.615: E/AndroidRuntime(1487):     at android.widget.AbsListView.onLayout(AbsListView.java:1260)
  10-20 16:32:56.615: E/AndroidRuntime(1487):     at android.view.View.layout(View.java:7175)
  10-20 16:32:56.615: E/AndroidRuntime(1487):     at android.widget.FrameLayout.onLayout(FrameLayout.java:338)
  10-20 16:32:56.615: E/AndroidRuntime(1487):     at android.view.View.layout(View.java:7175)
  10-20 16:32:56.615: E/AndroidRuntime(1487):     at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1254)
  10-20 16:32:56.615: E/AndroidRuntime(1487):     at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1130)
  10-20 16:32:56.615: E/AndroidRuntime(1487):     at android.widget.LinearLayout.onLayout(LinearLayout.java:1047)
  10-20 16:32:56.615: E/AndroidRuntime(1487):     at android.view.View.layout(View.java:7175)
  10-20 16:32:56.615: E/AndroidRuntime(1487):     at android.widget.FrameLayout.onLayout(FrameLayout.java:338)
  10-20 16:32:56.615: E/AndroidRuntime(1487):     at android.view.View.layout(View.java:7175)
  10-20 16:32:56.615: E/AndroidRuntime(1487):     at android.view.ViewRoot.performTraversals(ViewRoot.java:1140)
  10-20 16:32:56.615: E/AndroidRuntime(1487):     at android.view.ViewRoot.handleMessage(ViewRoot.java:1859)
  </code></pre>