title: I want to start a new activity when I click on a listview item
body: <p>I properly set the OnItemClickListener but it crashes when I click on one of the list item. I want to know if it can even be done</p>
  
  <p>Here is the code</p>
  
  <p>Update:</p>
  
  <pre><code> public class Inbox extends ListActivity {
  
      private static String[] numbers;
      private static String[] content;
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.inbox_list);
          DictionaryOpenHelper helper = new DictionaryOpenHelper(this,"MyTable", null, 2);
          SQLiteDatabase database  = helper.getReadableDatabase();
          Cursor c = database.rawQuery("SELECT * FROM MyTable", null);
  
          numbers = new String[c.getCount()];     
          content = new String[c.getCount()];
              c.moveToFirst();
              int count = 0;
              do{
                  numbers[count] = c.getString(c.getColumnIndex("PhoneNumber"));
                  content[count] = c.getString(c.getColumnIndex("Message"));
                  count++;
              }
              while(c.moveToNext());
  
              database.close();
          setListAdapter(new ArrayAdapter&lt;String&gt;(this,
                  android.R.layout.simple_list_item_1,
                  numbers));
      this.getListView().setOnItemClickListener(listener);
          }
      private OnItemClickListener listener = new OnItemClickListener() {
  
          @Override
          public void onItemClick(AdapterView&lt;?&gt; arg0, View arg1, int arg2,
                  long arg3) {
              Intent intent = new Intent(Inbox.this, ContDisplay.class);
              intent.putExtra("number", numbers[arg2]);
              startActivity(intent);
          }
      };
  }
  </code></pre>
  
  <p>inside Oncreate:</p>
  
  <pre><code>this.getListView().setOnItemClickListener(listener);
  </code></pre>