title: Error NPE then setup adapter of the listview
body: <pre><code>public class Tab1 extends Activity {
  
  ListView list;
  LazyAdapter adapter;
  
  ArrayList&lt;HashMap&lt;String, String&gt;&gt; itemList = new ArrayList&lt;HashMap&lt;String, String&gt;&gt;();
  
  @Override
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.tab1);
  
      Document doc = MainActivity.parser.getDomElement(MainActivity.xml);
      NodeList nl = doc.getElementsByTagName("tab1");
  
      for (int i = 0; i &lt; nl.getLength(); i++) {
          // creating new HashMap
          HashMap&lt;String, String&gt; map = new HashMap&lt;String, String&gt;();
          Element e = (Element) nl.item(i);
          // adding each child node to HashMap key =&gt; value
          map.put(MainActivity.KEY_ID,
                  MainActivity.parser.getValue(e, MainActivity.KEY_ID));
          ...
  
          // adding HashList to ArrayList
          itemList.add(map);
      }
  
      // Getting adapter by passing xml data ArrayList
      adapter = new LazyAdapter(this, itemList);
      list.setAdapter(adapter);  &lt;&lt;&lt;&lt;&lt;&lt; ERROR &lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;
  }
  }
  </code></pre>
  
  <p>-</p>
  
  <pre><code>Error - java.lang.RuntimeException: Unable to start activity        
  ComponentInfo{com.example.tabhost/com.example.tabhost.Tab1}: java.lang.NullPointerException
  
  E/AndroidRuntime(2822): Caused by: java.lang.NullPointerException
  </code></pre>
  
  <p>LazyAdapter.java</p>
  
  <pre><code>public class LazyAdapter extends BaseAdapter {
  
      private Activity activity;
      private ArrayList&lt;HashMap&lt;String, String&gt;&gt; data;
      private static LayoutInflater inflater=null;
      public ImageLoader imageLoader; 
  
      public LazyAdapter(Activity a, ArrayList&lt;HashMap&lt;String, String&gt;&gt; d) {
          activity = a;
          data=d;
          inflater = (LayoutInflater)activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
          imageLoader=new ImageLoader(activity.getApplicationContext());
      }
  
      public int getCount() {
          return data.size();
      }
  
      public Object getItem(int position) {
          return data.get(position) ; 
      }
  
      public long getItemId(int position) {
          return position;
      }
  
      public View getView(int position, View convertView, ViewGroup parent) {
          View vi=convertView;
          if(convertView==null)
              vi = inflater.inflate(R.layout.list_row, null);
  
          TextView title = (TextView)vi.findViewById(R.id.title); // title
  
          ImageView thumb_image=(ImageView)vi.findViewById(R.id.list_image); // thumb image
  
          HashMap&lt;String, String&gt; song = new HashMap&lt;String, String&gt;();
          song = data.get(position);
  
          // Setting all values in listview
          title.setText(song.get(MainActivity.KEY_TITLE));
  
          imageLoader.DisplayImage(song.get(MainActivity.KEY_THUMB_URL), thumb_image);
          return vi;
      }
  }
  </code></pre>