andorid app进入一个特定的画面按home后台后,切换系统语言,app直接挂掉了,空指针

报错的原因是getFragmentManager().beginTransaction();为空指针,这是为什么呢?

01-01 08:22:13.900: D/patnav_app_app_receiver(4055): onReceive:android.intent.action.LOCALE_CHANGED
01-01 08:22:13.960: D/AndroidRuntime(4055): Shutting down VM
01-01 08:22:13.960: W/dalvikvm(4055): threadid=1: thread exiting with uncaught exception (group=0x40015560)
01-01 08:22:14.220: D/dalvikvm(4055): GC_CONCURRENT freed 1296K, 36% free 2825K/4359K, external 8824K/10843K, paused 3ms+2ms
01-01 08:22:14.230: E/AndroidRuntime(4055): FATAL EXCEPTION: main
01-01 08:22:14.230: E/AndroidRuntime(4055): java.lang.RuntimeException: Unable to destroy activity {com.pateonavi.naviapp/com.pateonavi.naviapp.activity.MainMapActivity}: java.lang.NullPointerException
01-01 08:22:14.230: E/AndroidRuntime(4055): at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:2672)
01-01 08:22:14.230: E/AndroidRuntime(4055): at android.app.ActivityThread.handleDestroyActivity(ActivityThread.java:2690)
01-01 08:22:14.230: E/AndroidRuntime(4055): at android.app.ActivityThread.access$2100(ActivityThread.java:117)
01-01 08:22:14.230: E/AndroidRuntime(4055): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:964)
01-01 08:22:14.230: E/AndroidRuntime(4055): at android.os.Handler.dispatchMessage(Handler.java:99)
01-01 08:22:14.230: E/AndroidRuntime(4055): at android.os.Looper.loop(Looper.java:130)
01-01 08:22:14.230: E/AndroidRuntime(4055): at android.app.ActivityThread.main(ActivityThread.java:3683)
01-01 08:22:14.230: E/AndroidRuntime(4055): at java.lang.reflect.Method.invokeNative(Native Method)
01-01 08:22:14.230: E/AndroidRuntime(4055): at java.lang.reflect.Method.invoke(Method.java:507)
01-01 08:22:14.230: E/AndroidRuntime(4055): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:847)
01-01 08:22:14.230: E/AndroidRuntime(4055): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:605)
01-01 08:22:14.230: E/AndroidRuntime(4055): at dalvik.system.NativeStart.main(Native Method)
01-01 08:22:14.230: E/AndroidRuntime(4055): Caused by: java.lang.NullPointerException
01-01 08:22:14.230: E/AndroidRuntime(4055): at com.pateonavi.naviapp.mode.RoutePlanMode$1.onModeClosed(RoutePlanMode.java:88)
01-01 08:22:14.230: E/AndroidRuntime(4055): at com.pateonavi.navilib_as21.mode.BaseMode.onDestroy(BaseMode.java:79)
01-01 08:22:14.230: E/AndroidRuntime(4055): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1031)
01-01 08:22:14.230: E/AndroidRuntime(4055): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1083)
01-01 08:22:14.230: E/AndroidRuntime(4055): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1065)
01-01 08:22:14.230: E/AndroidRuntime(4055): at android.support.v4.app.FragmentManagerImpl.dispatchDestroy(FragmentManager.java:1877)
01-01 08:22:14.230: E/AndroidRuntime(4055): at android.support.v4.app.FragmentActivity.onDestroy(FragmentActivity.java:316)
01-01 08:22:14.230: E/AndroidRuntime(4055): at com.pateonavi.navilib_as21.maps.MapActivity.onDestroy(MapActivity.java:39)
01-01 08:22:14.230: E/AndroidRuntime(4055): at com.pateonavi.naviapp.activity.MainMapActivity.onDestroy(MainMapActivity.java:1264)
01-01 08:22:14.230: E/AndroidRuntime(4055): at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:2659)
01-01 08:22:14.230: E/AndroidRuntime(4055): ... 11 more
01-01 08:22:14.420: I/Process(4055): Sending signal. PID: 4055 SIG: 9

2个回答

ondestroy里面的代码呢

lixuesong13
devin_lxs 没有重写啊
4 年多之前 回复

图片说明 你应该有注册广播,这个action应该是没设定,然后在调用
destroy里面的方法时,就出现了空值图片说明

lixuesong13
devin_lxs 对的,是有广播的,不过对你的说法有点模糊,这个action应该是没设定指的是什么?是接收广播后进行的处理么?
4 年多之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问