Android 应用程序 - 新 Activity 未打开

Android App - New Activity not opening

在我的 android 应用程序中,我有一个导航抽屉菜单,它填充了一个字符串数组。当我单击单个字符串时,我想打开一个新的 activity(两者都是片段活动)。这不像我想象的那样有效。还有什么合适的方式吗?

public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
    SelectItem(position);
}

public void SelectItem(int position) {
    listView.setItemChecked(position, true);

    Intent testIntent = new Intent(MainActivity.this, AnotherActivity.class);

    //for example:
    if (position == 2) {
        startActivity(testIntent);
    }
}

logcat 错误:http://pastebin.com/v8pbpC0S

这是 class "AnotherActivity" 的内容:http://pastebin.com/zEymwJNQ 根据 logcat 判断,我认为错误发生在此处。

您在第 33 行有 NullPointerException

com.ex.app.AnotherActivity.onCreate(AnotherActivity.java:33)

看起来 ListView 参考是 null