NullPointerException with simpleAdapter in android
<p>I am using a simpleAdapter to create a listview, however I get this error:</p>

<pre><code>Caused by: java.lang.NullPointerException
at com.tab.Activity.onCreate(Activity.java:36)
</code></pre>

<p>and this the code that I am using:</p>

<pre><code>ArrayList&lt;HashMap&lt;String,String&gt;&gt; list = new ArrayList&lt;HashMap&lt;String,String&gt;&gt;();
 private SimpleAdapter notes;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.layout);

    notes = new SimpleAdapter( 
            this, 
            list,
            R.layout.display_layout,
            new String[] { "line1" },
            new int[] { R.id.text1}  );
   ListView lv = (ListView) findViewById(R.id.listview);
   lv.setAdapter( notes );
}
</code></pre>

<p>line 36 would be</p>

<pre><code>new int[] { R.id.text1}  );
</code></pre>

<p>text1 is defined, so why I am getting nullpointer error?</p>
