几次更改我的微调器的语言后,活动停止,但未收到任何消息。 代码如下: 首先,我将新选择的语言保存在配置文件中,然后重新创建活动:
if(ConfigManager.getInstance().getData().getGeneral().language != event.getLanguage()) {
ConfigManager.getInstance().getData().getGeneral().language = event.getLanguage();
ConfigManager.getInstance().save();
recreate();
然后在OnCreate函数中设置以前保存的新语言:
Resources resources = getResources();
Configuration configuration = resources.getConfiguration();
if (languageList.contains(language))
configuration.setLocale(new Locale(Language.values()[languageList.indexOf(language)].name().toLowerCase())); // API 17+ only.
有人可以帮忙吗,我看不出有时会使应用程序崩溃的原因? 谢谢!
来自Logcat:
" --------- beginning of crash
07-10 23:21:48.753 5556-5587/ A/libc: Fatal signal 6 (SIGABRT), code -6 in tid 5587 (RenderThread)
07-10 23:21:48.843 5556-5968/ I/OMXClient: Using client-side OMX mux.
07-10 23:21:48.855 166-166/? A/DEBUG: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
07-10 23:21:48.855 166-166/? A/DEBUG: Build fingerprint: 'Android/var_mx6/var_mx6:6.0.1/2.1.0-ga-rc2/20160715:eng/release-keys'
07-10 23:21:48.855 166-166/? A/DEBUG: Revision: '0'
07-10 23:21:48.855 166-166/? A/DEBUG: ABI: 'arm'
07-10 23:21:48.856 166-166/? A/DEBUG: pid: 5556, tid: 5587, name: RenderThread >>> <<<
07-10 23:21:48.856 166-166/? A/DEBUG: signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
07-10 23:21:48.906 166-166/? A/DEBUG: Abort message: 'Encountered EGL error 12299 EGL_BAD_NATIVE_WINDOW during rendering'
07-10 23:21:48.906 166-166/? A/DEBUG: r0 00000000 r1 000015d3 r2 00000006 r3 997e3978
07-10 23:21:48.906 166-166/? A/DEBUG: r4 997e3980 r5 997e3930 r6 00000019 r7 0000010c
07-10 23:21:48.906 166-166/? A/DEBUG: r8 0000300b r9 82f1d800 sl 90521720 fp b6f88c55
07-10 23:21:48.906 166-166/? A/DEBUG: ip 00000006 sp 997e3330 lr b6d62fc5 pc b6d653c0 cpsr 400f0010
07-10 23:21:48.929 166-166/? A/DEBUG: backtrace:
07-10 23:21:48.929 166-166/? A/DEBUG: #00 pc 000423c0 /system/lib/libc.so (tgkill+12)
07-10 23:21:48.929 166-166/? A/DEBUG: #01 pc 0003ffc1 /system/lib/libc.so (pthread_kill+32)
07-10 23:21:48.929 166-166/? A/DEBUG: #02 pc 0001c61f /system/lib/libc.so (raise+10)
07-10 23:21:48.929 166-166/? A/DEBUG: #03 pc 000197c1 /system/lib/libc.so (__libc_android_abort+34)
07-10 23:21:48.930 166-166/? A/DEBUG: #04 pc 000174b8 /system/lib/libc.so (abort+4)
07-10 23:21:48.930 166-166/? A/DEBUG: #05 pc 00008933 /system/lib/libcutils.so (__android_log_assert+86)
07-10 23:21:48.930 166-166/? A/DEBUG: #06 pc 0001cceb /system/lib/libhwui.so
07-10 23:21:48.930 166-166/? A/DEBUG: #07 pc 0001a33b /system/lib/libhwui.so
07-10 23:21:48.930 166-166/? A/DEBUG: #08 pc 0001be6d /system/lib/libhwui.so
07-10 23:21:48.930 166-166/? A/DEBUG: #09 pc 0001e907 /system/lib/libhwui.so (android::uirenderer::renderthread::RenderThread::threadLoop()+62)
07-10 23:21:48.930 166-166/? A/DEBUG: #10 pc 00010115 /system/lib/libutils.so (android::Thread::_threadLoop(void*)+112)
07-10 23:21:48.930 166-166/? A/DEBUG: #11 pc 0005d907 /system/lib/libandroid_runtime.so (android::AndroidRuntime::javaThreadShell(void*)+70)
07-10 23:21:48.930 166-166/? A/DEBUG: #12 pc 0003f8c3 /system/lib/libc.so (__pthread_start(void*)+30)
07-10 23:21:48.930 166-166/? A/DEBUG: #13 pc 00019e55 /system/lib/libc.so (__start_thread+6)
07-10 23:21:50.925 477-536/system_process E/NativeCrashListener: Exception dealing with report
android.system.ErrnoException: read failed: EAGAIN (Try again)
at libcore.io.Posix.readBytes(Native Method)
at libcore.io.Posix.read(Posix.java:169)
at libcore.io.BlockGuardOs.read(BlockGuardOs.java:230)
at android.system.Os.read(Os.java:367)
at com.android.server.am.NativeCrashListener.consumeNativeCrashData(NativeCrashListener.java:240)
at com.android.server.am.NativeCrashListener.run(NativeCrashListener.java:138)
07-10 23:21:51.721 168-471/? W/audio_hw_primary: do_out_standby... -1242766016
07-10 23:21:52.630 166-166/? A/DEBUG: Tombstone written to: /data/tombstones/tombstone_08
07-10 23:21:52.630 166-166/? E/DEBUG: AM write failed: Broken pipe
07-10 23:21:52.635 477-494/system_process I/BootReceiver: Copying /data/tombstones/tombstone_08 to DropBox (SYSTEM_TOMBSTONE)
07-10 23:21:52.731 477-4804/system_process I/WindowState: WIN DEATH: Window{821b87f u0 /.view.MainActivity}
07-10 23:21:52.736 477-489/system_process D/GraphicsStats: Buffer count: 2
07-10 23:21:52.739 477-2400/system_process W/InputMethodManagerService: Session failed to close due to remote exception
android.os.DeadObjectException
at android.os.BinderProxy.transactNative(Native Method)
at android.os.BinderProxy.transact(Binder.java:503)
at com.android.internal.view.IInputMethodSession$Stub$Proxy.finishSession(IInputMethodSession.java:305)
at com.android.server.InputMethodManagerService.finishSessionLocked(InputMethodManagerService.java:1599)
at com.android.server.InputMethodManagerService.clearClientSessionLocked(InputMethodManagerService.java:1590)
at com.android.server.InputMethodManagerService.removeClient(InputMethodManagerService.java:1246)
at com.android.server.wm.Session.binderDied(Session.java:145)
at android.os.BinderProxy.sendDeathNotice(Binder.java:558)
07-10 23:21:52.745 477-477/system_process W/InputMethodManagerService: Session failed to close due to remote exception
android.os.DeadObjectException
at android.os.BinderProxy.transactNative(Native Method)
at android.os.BinderProxy.transact(Binder.java:503)
at com.android.internal.view.IInputMethodSession$Stub$Proxy.finishSession(IInputMethodSession.java:305)
at com.android.server.InputMethodManagerService.finishSessionLocked(InputMethodManagerService.java:1599)
at com.android.server.InputMethodManagerService.clearClientSessionLocked(InputMethodManagerService.java:1590)
at com.android.server.InputMethodManagerService.clearCurMethodLocked(InputMethodManagerService.java:1616)
at com.android.server.InputMethodManagerService.onServiceDisconnected(InputMethodManagerService.java:1635)
at android.app.LoadedApk$ServiceDispatcher.doDeath(LoadedApk.java:1228)
at android.app.LoadedApk$ServiceDispatcher$RunConnection.run(LoadedApk.java:1242)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:148)
at com.android.server.SystemServer.run(SystemServer.java:283)
at com.android.server.SystemServer.main(SystemServer.java:168)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
07-10 23:21:52.759 172-172/? I/Zygote: Process 5556 exited due to signal (6)
07-10 23:21:52.763 477-1340/system_process I/ActivityManager: Process (pid 5556) has died
07-10 23:21:52.764 477-1340/system_process W/ActivityManager: Scheduling restart of crashed service /.view.CustomKeyboardService in 1000ms
07-10 23:21:52.764 477-1340/system_process W/ActivityManager: Force removing ActivityRecord{ade24ae u0 /.view.MainActivity t1367}: app died, no saved state
07-10 23:21:52.801 163-201/? E/BufferQueueProducer: [com.android.launcher/com.android.launcher2.Launcher] dequeueBuffer: can't dequeue multiple buffers without setting the buffer count
07-10 23:21:52.807 477-597/system_process W/InputMethodManagerService: Got RemoteException sending setActive(false) notification to pid 5556 uid 10046
07-10 23:21:53.795 477-491/system_process I/ActivityManager: Start proc 5975:/u0a46 for service /.view.CustomKeyboardService
07-10 23:21:53.856 5975-5975/? I/art: Not late-enabling -Xcheck:jni (already on)
07-10 23:21:53.856 5975-5975/? I/art: Late-enabling JIT
07-10 23:21:53.872 5975-5975/? I/art: JIT created with code_cache_capacity=2MB compile_threshold=1000
07-10 23:21:54.001 5975-5975/ W/art: Method processed more than once: void com.scichart.core.licensing.Decoder.<init>(java.lang.String)
07-10 23:22:00.023 746-958/com.android.launcher W/OpenGLRenderer: Incorrectly called buildLayer on View: ShortcutAndWidgetContainer, destroying layer..."