菜单按钮强制关闭android?

发布于 2024-11-04 01:26:11 字数 2577 浏览 2 评论 0原文

当您打开菜单按钮并转到设置然后按后退按钮时,我的应用程序运行良好,但是当我将 Google 地图 API 添加到我的应用程序中时,后退按钮会强制关闭应用程序。还有其他人遇到同样的问题吗?如果是这样,你是如何解决的?或者有谁知道如何解决这个问题?

编辑:

我的日志猫错误后退按钮强制关闭

04-29 16:02:13.155: ERROR/AndroidRuntime(16828): FATAL EXCEPTION: main
04-29 16:02:13.155: ERROR/AndroidRuntime(16828): java.lang.RuntimeException: Unable to            resume activity {www.Freshapp.com.Thumper.html/www.Freshapp.com.Thumper.html.Thumper}: java.lang.NullPointerException
04-29 16:02:13.155: ERROR/AndroidRuntime(16828):     at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3128)
04-29 16:02:13.155: ERROR/AndroidRuntime(16828):     at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3143)
04-29 16:02:13.155: ERROR/AndroidRuntime(16828):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2059)
04-29 16:02:13.155: ERROR/AndroidRuntime(16828):     at android.os.Handler.dispatchMessage(Handler.java:99)
04-29 16:02:13.155: ERROR/AndroidRuntime(16828):     at android.os.Looper.loop(Looper.java:123)
04-29 16:02:13.155: ERROR/AndroidRuntime(16828):     at android.app.ActivityThread.main(ActivityThread.java:4627)
04-29 16:02:13.155: ERROR/AndroidRuntime(16828):     at java.lang.reflect.Method.invokeNative(Native Method)
04-29 16:02:13.155: ERROR/AndroidRuntime(16828):     at java.lang.reflect.Method.invoke(Method.java:521)
04-29 16:02:13.155: ERROR/AndroidRuntime(16828):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:858)
04-29 16:02:13.155: ERROR/AndroidRuntime(16828):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
04-29 16:02:13.155: ERROR/AndroidRuntime(16828):     at dalvik.system.NativeStart.main(Native Method)
04-29 16:02:13.155: ERROR/AndroidRuntime(16828): Caused by: java.lang.NullPointerException
04-29 16:02:13.155: ERROR/AndroidRuntime(16828):     at com.google.android.maps.MapActivity.onResume(MapActivity.java:431)
04-29 16:02:13.155: ERROR/AndroidRuntime(16828):     at www.Freshapp.com.Thumper.html.Thumper.onResume(Thumper.java:181)
04-29 16:02:13.155: ERROR/AndroidRuntime(16828):     at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1149)
04-29 16:02:13.155: ERROR/AndroidRuntime(16828):     at android.app.Activity.performResume(Activity.java:3823)
04-29 16:02:13.155: ERROR/AndroidRuntime(16828):     at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3118)

编辑2

我拿出了我的地图视图和地图视图所在的滑动抽屉以及与地图有关的所有内容并且应用程序没有获得 FC。

-谢谢

I have and application that worked fine when you opened the menu button and went to the settings then pushed the back button but when I added the Google maps API into my application the back button force closes the application. Has there been any one else with this same issue? If so how did you fix it? Or does anyone know how to fix this problem?

Edit:

My log cat errors on back button force close

04-29 16:02:13.155: ERROR/AndroidRuntime(16828): FATAL EXCEPTION: main
04-29 16:02:13.155: ERROR/AndroidRuntime(16828): java.lang.RuntimeException: Unable to            resume activity {www.Freshapp.com.Thumper.html/www.Freshapp.com.Thumper.html.Thumper}: java.lang.NullPointerException
04-29 16:02:13.155: ERROR/AndroidRuntime(16828):     at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3128)
04-29 16:02:13.155: ERROR/AndroidRuntime(16828):     at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3143)
04-29 16:02:13.155: ERROR/AndroidRuntime(16828):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2059)
04-29 16:02:13.155: ERROR/AndroidRuntime(16828):     at android.os.Handler.dispatchMessage(Handler.java:99)
04-29 16:02:13.155: ERROR/AndroidRuntime(16828):     at android.os.Looper.loop(Looper.java:123)
04-29 16:02:13.155: ERROR/AndroidRuntime(16828):     at android.app.ActivityThread.main(ActivityThread.java:4627)
04-29 16:02:13.155: ERROR/AndroidRuntime(16828):     at java.lang.reflect.Method.invokeNative(Native Method)
04-29 16:02:13.155: ERROR/AndroidRuntime(16828):     at java.lang.reflect.Method.invoke(Method.java:521)
04-29 16:02:13.155: ERROR/AndroidRuntime(16828):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:858)
04-29 16:02:13.155: ERROR/AndroidRuntime(16828):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
04-29 16:02:13.155: ERROR/AndroidRuntime(16828):     at dalvik.system.NativeStart.main(Native Method)
04-29 16:02:13.155: ERROR/AndroidRuntime(16828): Caused by: java.lang.NullPointerException
04-29 16:02:13.155: ERROR/AndroidRuntime(16828):     at com.google.android.maps.MapActivity.onResume(MapActivity.java:431)
04-29 16:02:13.155: ERROR/AndroidRuntime(16828):     at www.Freshapp.com.Thumper.html.Thumper.onResume(Thumper.java:181)
04-29 16:02:13.155: ERROR/AndroidRuntime(16828):     at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1149)
04-29 16:02:13.155: ERROR/AndroidRuntime(16828):     at android.app.Activity.performResume(Activity.java:3823)
04-29 16:02:13.155: ERROR/AndroidRuntime(16828):     at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3118)

Edit 2

I took out my map view and the sliding drawer that the map view was in and everything to do with the map and the application gets no FC.

-Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

枕头说它不想醒 2024-11-11 01:26:11

我想通了,我只需要在我的设置中添加一个后退按钮功能即可。现在效果很好

public boolean onKeyDown(int keyCode, KeyEvent event) {
    Log.d(null,"In on Key Down");
    if (keyCode == KeyEvent.KEYCODE_BACK) {
  Intent intent=new Intent(Settings.this,Thumper.class);
  startActivity(intent);
        return true;
    }

    return false;
}

I figured it out, I just needed to add a back button function inside of my Setting. Works great now

public boolean onKeyDown(int keyCode, KeyEvent event) {
    Log.d(null,"In on Key Down");
    if (keyCode == KeyEvent.KEYCODE_BACK) {
  Intent intent=new Intent(Settings.this,Thumper.class);
  startActivity(intent);
        return true;
    }

    return false;
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文