嗨,当我运行我的应用程序并单击我的应用程序中的按钮时,它会因为单击按钮而停止,我在我的Log cat中得到这个,任何帮助都会非常有帮助
04-13 16:43:15.435: D/AndroidRuntime(540): Shutting down VM
04-13 16:43:15.445: W/dalvikvm(540): threadid=1: thread exiting with uncaught exception (group=0x409961f8)
04-13 16:43:15.485: E/AndroidRuntime(540): FATAL EXCEPTION: main
04-13 16:43:15.485: E/AndroidRuntime(540): java.lang.IllegalStateException: Could not execute method of the activity
04-13 16:43:15.485: E/AndroidRuntime(540): at android.view.View$1.onClick(View.java:3039)
04-13 16:43:15.485: E/AndroidRuntime(540): at android.view.View.performClick(View.java:3480)
04-13 16:43:15.485: E/AndroidRuntime(540): at android.view.View$PerformClick.run(View.java:13983)
04-13 16:43:15.485: E/AndroidRuntime(540): at android.os.Handler.handleCallback(Handler.java:605)
04-13 16:43:15.485: E/AndroidRuntime(540): at android.os.Handler.dispatchMessage(Handler.java:92)
04-13 16:43:15.485: E/AndroidRuntime(540): at android.os.Looper.loop(Looper.java:137)
04-13 16:43:15.485: E/AndroidRuntime(540): at android.app.ActivityThread.main(ActivityThread.java:4340)
04-13 16:43:15.485: E/AndroidRuntime(540): at java.lang.reflect.Method.invokeNative(Native Method)
04-13 16:43:15.485: E/AndroidRuntime(540): at java.lang.reflect.Method.invoke(Method.java:511)
04-13 16:43:15.485: E/AndroidRuntime(540): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
04-13 16:43:15.485: E/AndroidRuntime(540): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
04-13 16:43:15.485: E/AndroidRuntime(540): at dalvik.system.NativeStart.main(Native Method)
04-13 16:43:15.485: E/AndroidRuntime(540): Caused by: java.lang.reflect.InvocationTargetException
04-13 16:43:15.485: E/AndroidRuntime(540): at java.lang.reflect.Method.invokeNative(Native Method)
04-13 16:43:15.485: E/AndroidRuntime(540): at java.lang.reflect.Method.invoke(Method.java:511)
04-13 16:43:15.485: E/AndroidRuntime(540): at android.view.View$1.onClick(View.java:3034)
04-13 16:43:15.485: E/AndroidRuntime(540): ... 11 more
04-13 16:43:15.485: E/AndroidRuntime(540): Caused by: android.content.ActivityNotFoundException: Unable to find explicit activity class {com.example.SaverEvent/com.example.SaverEvent.MainActivity}; have you declared this activity in your AndroidManifest.xml?
04-13 16:43:15.485: E/AndroidRuntime(540): at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1508)
04-13 16:43:15.485: E/AndroidRuntime(540): at android.app.Instrumentation.execStartActivity(Instrumentation.java:1384)
04-13 16:43:15.485: E/AndroidRuntime(540): at android.app.Activity.startActivityForResult(Activity.java:3190)
04-13 16:43:15.485: E/AndroidRuntime(540): at android.app.Activity.startActivity(Activity.java:3297)
04-13 16:43:15.485: E/AndroidRuntime(540): at com.example.SaverEvent.NewEvent.callHomeActivity(NewEvent.java:35)
04-13 16:43:15.485: E/AndroidRuntime(540): at com.example.SaverEvent.NewEvent.addNewEvent(NewEvent.java:31)
04-13 16:43:15.485: E/AndroidRuntime(540): ... 14 more
04-13 16:43:17.995: I/Process(540): Sending signal. PID: 540 SIG: 9
答案 0 :(得分:0)
我认为,您的按钮将转到项目中的另一个活动。但是你没有在清单文件中声明你的第二个活动。这只是我的猜测,因为我没有看到你的代码。如果我没错,您需要在清单文件中的第一个活动后添加一行。
<activity android:name="com.example.SaverEvent.YOUR_SECOND_ACTIVITY" ></ activity>
希望得到这个帮助。