我正在为使用ImageButton
的应用程序执行代码,并且我已收到消息&#34; Unfortunately <appname> has stopped working
&#34;当我运行应用程序并按下ImageButton
时。
我是这类应用的新手,所以我不知道我的代码有什么问题,因为我的代码没有任何错误。
如果你能帮助我,我将非常感激。
我加入了Logcat
:
04-12 04:55:46.646: D/dalvikvm(775): GC_FOR_ALLOC freed 63K, 7% free 2654K/2840K, paused 57ms, total 69ms
04-12 04:55:46.824: D/dalvikvm(775): GC_CONCURRENT freed 204K, 11% free 2856K/3192K, paused 21ms+7ms, total 72ms
04-12 04:55:46.884: D/dalvikvm(775): GC_FOR_ALLOC freed 1K, 11% free 2871K/3192K, paused 34ms, total 34ms
04-12 04:55:46.924: I/dalvikvm-heap(775): Grow heap (frag case) to 4.640MB for 1808416-byte allocation
04-12 04:55:46.996: D/dalvikvm(775): GC_FOR_ALLOC freed <1K, 7% free 4637K/4960K, paused 72ms, total 72ms
04-12 04:55:47.084: D/dalvikvm(775): GC_CONCURRENT freed <1K, 7% free 4637K/4960K, paused 7ms+3ms, total 92ms
04-12 04:55:47.214: D/dalvikvm(775): GC_FOR_ALLOC freed <1K, 7% free 4637K/4960K, paused 37ms, total 37ms
04-12 04:55:47.263: I/dalvikvm-heap(775): Grow heap (frag case) to 7.708MB for 3216416-byte allocation
04-12 04:55:47.374: D/dalvikvm(775): GC_CONCURRENT freed 0K, 5% free 7778K/8104K, paused 15ms+3ms, total 106ms
04-12 04:55:48.105: D/gralloc_goldfish(775): Emulator without GPU emulation detected.
04-12 04:57:00.395: D/AndroidRuntime(775): Shutting down VM
04-12 04:57:00.395: W/dalvikvm(775): threadid=1: thread exiting with uncaught exception (group=0x40a71930)
04-12 04:57:00.405: E/AndroidRuntime(775): FATAL EXCEPTION: main
04-12 04:57:00.405: E/AndroidRuntime(775): android.content.ActivityNotFoundException: Unable to find explicit activity class {com.movil.ejemploventanas/com.movil.ejemploventanas.DatosPersonales}; have you declared this activity in your AndroidManifest.xml?
04-12 04:57:00.405: E/AndroidRuntime(775): at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1618)
04-12 04:57:00.405: E/AndroidRuntime(775): at android.app.Instrumentation.execStartActivity(Instrumentation.java:1417)
04-12 04:57:00.405: E/AndroidRuntime(775): at android.app.Activity.startActivityForResult(Activity.java:3370)
04-12 04:57:00.405: E/AndroidRuntime(775): at android.app.Activity.startActivityForResult(Activity.java:3331)
04-12 04:57:00.405: E/AndroidRuntime(775): at android.app.Activity.startActivity(Activity.java:3566)
04-12 04:57:00.405: E/AndroidRuntime(775): at android.app.Activity.startActivity(Activity.java:3534)
04-12 04:57:00.405: E/AndroidRuntime(775): at com.movil.ejemploventanas.Principal$1.onClick(Principal.java:22)
04-12 04:57:00.405: E/AndroidRuntime(775): at android.view.View.performClick(View.java:4204)
04-12 04:57:00.405: E/AndroidRuntime(775): at android.view.View$PerformClick.run(View.java:17355)
04-12 04:57:00.405: E/AndroidRuntime(775): at android.os.Handler.handleCallback(Handler.java:725)
04-12 04:57:00.405: E/AndroidRuntime(775): at android.os.Handler.dispatchMessage(Handler.java:92)
04-12 04:57:00.405: E/AndroidRuntime(775): at android.os.Looper.loop(Looper.java:137)
04-12 04:57:00.405: E/AndroidRuntime(775): at android.app.ActivityThread.main(ActivityThread.java:5041)
04-12 04:57:00.405: E/AndroidRuntime(775): at java.lang.reflect.Method.invokeNative(Native Method)
04-12 04:57:00.405: E/AndroidRuntime(775): at java.lang.reflect.Method.invoke(Method.java:511)
04-12 04:57:00.405: E/AndroidRuntime(775): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
04-12 04:57:00.405: E/AndroidRuntime(775): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
04-12 04:57:00.405: E/AndroidRuntime(775): at dalvik.system.NativeStart.main(Native Method)
答案 0 :(得分:1)
在清单中添加活动名称。
答案 1 :(得分:1)
在清单
中声明您的活动<activity
android:name="yourActivityName" />
答案 2 :(得分:1)
在manifest
标记
application
下方添加以下行
<activity android:name="com.movil.ejemploventanas.DatosPersonales"/>