当我按下 ButtonImage 时,应用程序崩溃了。不幸的是,该应用程序已停止工作
App getting crashed when i press a ButtonImage. Unafortunately the app has stopped working
我正在为使用 ImageButton
的应用程序编写代码,当我 运行 应用程序并按 [=] 时,我一直收到消息“Unfortunately <appname> has stopped working
” 11=]。
我是这类应用程序的新手,所以我真的不知道我的代码有什么问题,因为我的代码没有任何错误。
如果你能在这方面帮助我,我将不胜感激。
我包括我的 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.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)
在您的清单中添加您的 activity 姓名。
在清单
中声明您的activity
<activity
android:name="yourActivityName" />
在 application
标签内的 manifest
添加下行
<activity android:name="com.movil.ejemploventanas.DatosPersonales"/>
我正在为使用 ImageButton
的应用程序编写代码,当我 运行 应用程序并按 [=] 时,我一直收到消息“Unfortunately <appname> has stopped working
” 11=]。
我是这类应用程序的新手,所以我真的不知道我的代码有什么问题,因为我的代码没有任何错误。
如果你能在这方面帮助我,我将不胜感激。
我包括我的 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.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)
在您的清单中添加您的 activity 姓名。
在清单
中声明您的activity<activity
android:name="yourActivityName" />
在 application
标签内的 manifest
添加下行
<activity android:name="com.movil.ejemploventanas.DatosPersonales"/>