我的 Android 清单中有这个:
<activity
android:name=".Planner"
android:label="---" >
<intent-filter>
<action android:name="com.---.---.PLANNER" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
但我在 Eclipse 中收到警告:Exported Activity Does not Require Permission
所以我把它改成这样:
<activity
android:name=".Planner"
android:label="---" />
警告消失,但一旦启动此活动,它就会强制关闭。这是LogCat:
11-29 19:22:03.569: E/AndroidRuntime(434): FATAL EXCEPTION: main
11-29 19:22:03.569: E/AndroidRuntime(434): android.content.ActivityNotFoundException: No Activity found to handle Intent { act=com.---.---.PLANNER }
11-29 19:22:03.569: E/AndroidRuntime(434): at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1409)
11-29 19:22:03.569: E/AndroidRuntime(434): at android.app.Instrumentation.execStartActivity(Instrumentation.java:1379)
11-29 19:22:03.569: E/AndroidRuntime(434): at android.app.Activity.startActivityForResult(Activity.java:2827)
11-29 19:22:03.569: E/AndroidRuntime(434): at android.app.Activity.startActivity(Activity.java:2933)
11-29 19:22:03.569: E/AndroidRuntime(434): at com.---.---.ManageDebts$3.onClick(ManageDebts.java:135)
11-29 19:22:03.569: E/AndroidRuntime(434): at android.view.View.performClick(View.java:2485)
11-29 19:22:03.569: E/AndroidRuntime(434): at android.view.View$PerformClick.run(View.java:9080)
11-29 19:22:03.569: E/AndroidRuntime(434): at android.os.Handler.handleCallback(Handler.java:587)
11-29 19:22:03.569: E/AndroidRuntime(434): at android.os.Handler.dispatchMessage(Handler.java:92)
11-29 19:22:03.569: E/AndroidRuntime(434): at android.os.Looper.loop(Looper.java:123)
11-29 19:22:03.569: E/AndroidRuntime(434): at android.app.ActivityThread.main(ActivityThread.java:3683)
11-29 19:22:03.569: E/AndroidRuntime(434): at java.lang.reflect.Method.invokeNative(Native Method)
11-29 19:22:03.569: E/AndroidRuntime(434): at java.lang.reflect.Method.invoke(Method.java:507)
11-29 19:22:03.569: E/AndroidRuntime(434): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
11-29 19:22:03.569: E/AndroidRuntime(434): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
11-29 19:22:03.569: E/AndroidRuntime(434): at dalvik.system.NativeStart.main(Native Method)
这是第 135 行:
startActivity(new Intent("com.---.---.PLANNER"));