无法从NavDrawer片段启动活动

时间:2014-10-12 20:12:22

标签: android android-fragments

您好我在我的应用程序中使用导航抽屉。从navDrawer片段我想打开一个活动,我想在该活动中显示listview我试图添加这两个意图来启动我的活动,我还在清单文件中添加了我的新CustomListView活动,但它不起作用,

Intent openList = new Intent(getActivity(), CustomListView.class);
            PrincipalSpeechFragment.this.startActivity(openList);

Intent openList = new Intent(getActivity(), CustomListView.class);
            startActivity(openList);

不幸的是,应用程序已关闭。谁能告诉我这方面的解决方案?

Logcat错误是:

10-13 01:49:19.391: E/AndroidRuntime(17979): FATAL EXCEPTION: main
10-13 01:49:19.391: E/AndroidRuntime(17979): Process: com.example.everwinvidhyashram, PID: 17979
10-13 01:49:19.391: E/AndroidRuntime(17979): java.lang.NullPointerException
10-13 01:49:19.391: E/AndroidRuntime(17979):    at    com.example.everwinvidhyashram.PrincipalSpeechFragment$1.onClick(PrincipalSpeechFragment.java:59)
10-13 01:49:19.391: E/AndroidRuntime(17979):    at android.view.View.performClick(View.java:4456)
10-13 01:49:19.391: E/AndroidRuntime(17979):    at android.view.View$PerformClick.run(View.java:18465)
10-13 01:49:19.391: E/AndroidRuntime(17979):    at android.os.Handler.handleCallback(Handler.java:733)
10-13 01:49:19.391: E/AndroidRuntime(17979):    at  android.os.Handler.dispatchMessage(Handler.java:95)
10-13 01:49:19.391: E/AndroidRuntime(17979):    at android.os.Looper.loop(Looper.java:136)
10-13 01:49:19.391: E/AndroidRuntime(17979):    at android.app.ActivityThread.main(ActivityThread.java:5086)
10-13 01:49:19.391: E/AndroidRuntime(17979):    at java.lang.reflect.Method.invokeNative(Native Method)
10-13 01:49:19.391: E/AndroidRuntime(17979):    at java.lang.reflect.Method.invoke(Method.java:515)
10-13 01:49:19.391: E/AndroidRuntime(17979):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
10-13 01:49:19.391: E/AndroidRuntime(17979):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
10-13 01:49:19.391: E/AndroidRuntime(17979):    at dalvik.system.NativeStart.main(Native Method)

0 个答案:

没有答案