-2

我的 android 应用程序有问题,我有一个手页,我改变了我的业务

startActivityForResult (intent, CODE_DE_MON_ACTIVITE).

它可以工作,但是当我用相同的代码替换第二个活动后的这个页面时,没有任何效果。应用程序崩溃。知道我拥有清单中的所有活动。

日志:

06-28 13:09:47.765: D/AndroidRuntime(254): Shutting down VM
06-28 13:09:47.765: W/dalvikvm(254): threadid=3: thread exiting with uncaught exception (group=0x4001b188)
06-28 13:09:47.765: E/AndroidRuntime(254): Uncaught handler: thread main exiting due to uncaught exception
06-28 13:09:47.775: E/AndroidRuntime(254): java.lang.RuntimeException: Unable to start activity ComponentInfo{referencehit.android/referencehit.android.AddTournamentActivity}: java.lang.NullPointerException
06-28 13:09:47.775: E/AndroidRuntime(254):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2496)
06-28 13:09:47.775: E/AndroidRuntime(254):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2512)
06-28 13:09:47.775: E/AndroidRuntime(254):  at android.app.ActivityThread.access$2200(ActivityThread.java:119)
06-28 13:09:47.775: E/AndroidRuntime(254):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1863)
06-28 13:09:47.775: E/AndroidRuntime(254):  at android.os.Handler.dispatchMessage(Handler.java:99)
06-28 13:09:47.775: E/AndroidRuntime(254):  at android.os.Looper.loop(Looper.java:123)
06-28 13:09:47.775: E/AndroidRuntime(254):  at android.app.ActivityThread.main(ActivityThread.java:4363)
06-28 13:09:47.775: E/AndroidRuntime(254):  at java.lang.reflect.Method.invokeNative(Native Method)
06-28 13:09:47.775: E/AndroidRuntime(254):  at java.lang.reflect.Method.invoke(Method.java:521)
06-28 13:09:47.775: E/AndroidRuntime(254):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
06-28 13:09:47.775: E/AndroidRuntime(254):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
06-28 13:09:47.775: E/AndroidRuntime(254):  at dalvik.system.NativeStart.main(Native Method)
06-28 13:09:47.775: E/AndroidRuntime(254): Caused by: java.lang.NullPointerException
06-28 13:09:47.775: E/AndroidRuntime(254):  at referencehit.android.AddTournamentActivity.onCreate(AddTournamentActivity.java:38)
06-28 13:09:47.775: E/AndroidRuntime(254):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
06-28 13:09:47.775: E/AndroidRuntime(254):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2459)
06-28 13:09:47.775: E/AndroidRuntime(254):  ... 11 more
06-28 13:09:47.788: I/dalvikvm(254): threadid=7: reacting to signal 3
06-28 1
3:09:47.788: E/dalvikvm(254): Unable to open stack trace file '/data/anr/traces.txt': Permission denied

你对我的问题有想法吗?

4

2 回答 2

1

你真的给 赋值了Intent吗?简单的编码会在你调用时Intent intent;抛出一个,就像你得到的那样。或者,您是否已将您的第二个活动添加到清单文件中?Android 不会启动不在其 Manifest 中的 Activity。NullPointerExceptionstartActivity(intent);

于 2012-06-28T13:26:15.587 回答
1

向您的 AndroidManifest.xml 添加以下权限

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

如果您忘记添加它,请添加它。

于 2012-06-28T13:28:30.403 回答