私のアクティビティでは、インフレートを使用してロードされたボトムメニューがあります(メニューにはhorizontalScrollView
いくつかのボタンがあります(アクティビティごとに1つが選択され、1つが選択解除されています))。
このメニューをすばやく移動すると、例外が発生することがあります (ポイントはランダムです)。何らかの理由で、Android が何かを強制終了したため、アクティビティに使用できないようです。
エラーログ:
12-12 09:24:24.389: I/Process(480): Sending signal. PID: 480 SIG: 9
12-12 09:24:24.430: I/ActivityManager(81): Process com.apia.selfnettest (pid 480) has died.
12-12 09:24:24.439: I/WindowManager(81): WIN DEATH: Window{405b6c28 com.apia.selfnettest/com.apia.selfnettest.MainClass paused=false}
12-12 09:24:24.459: E/InputDispatcher(81): channel '407da4a8 com.apia.selfnettest/com.apia.selfnettest.MainClass (server)' ~ Consumer closed input channel or an error occurred. events=0x8
12-12 09:24:24.459: E/InputDispatcher(81): channel '407da4a8 com.apia.selfnettest/com.apia.selfnettest.MainClass (server)' ~ Channel is unrecoverably broken and will be disposed!
12-12 09:24:24.609: I/WindowManager(81): WIN DEATH: Window{40613eb8 com.apia.selfnettest/com.apia.selfnettest.MainClass paused=false}
12-12 09:24:24.769: I/WindowManager(81): WIN DEATH: Window{405fc890 com.apia.selfnettest/com.apia.selfnettest.MainClass paused=false}
12-12 09:24:24.960: I/WindowManager(81): WIN DEATH: Window{409d4d48 com.apia.selfnettest/com.apia.selfnettest.MainClass paused=false}
12-12 09:24:25.030: I/WindowManager(81): WIN DEATH: Window{408c5d58 com.apia.selfnettest/com.apia.selfnettest.ContactOffline paused=false}
12-12 09:24:25.189: I/WindowManager(81): WIN DEATH: Window{408f4090 com.apia.selfnettest/com.apia.selfnettest.InformationOffline paused=false}
12-12 09:24:25.289: I/WindowManager(81): WIN DEATH: Window{406f0470 com.apia.selfnettest/com.apia.selfnettest.MainClass paused=false}
12-12 09:24:25.459: I/WindowManager(81): WIN DEATH: Window{4054e0b8 com.apia.selfnettest/com.apia.selfnettest.MainClass paused=false}
12-12 09:24:25.579: I/WindowManager(81): WIN DEATH: Window{406f7be0 com.apia.selfnettest/com.apia.selfnettest.MainClass paused=false}
12-12 09:24:25.679: I/WindowManager(81): WIN DEATH: Window{409eb980 com.apia.selfnettest/com.apia.selfnettest.MainClass paused=false}
12-12 09:24:25.819: I/ActivityManager(81): Start proc com.apia.selfnettest for activity com.apia.selfnettest/.MainClass: pid=520 uid=10034 gids={3003, 1006, 1015}
12-12 09:24:25.829: I/WindowManager(81): WINDOW DIED Window{407da4a8 com.apia.selfnettest/com.apia.selfnettest.MainClass paused=false}
12-12 09:24:25.859: I/WindowManager(81): WIN DEATH: Window{40774410 com.apia.selfnettest/com.apia.selfnettest.MainClass paused=false}
12-12 09:24:25.899: E/InputDispatcher(81): Received spurious receive callback for unknown input channel. fd=160, events=0x8
12-12 09:24:25.899: E/InputDispatcher(81): Received spurious receive callback for unknown input channel. fd=163, events=0x8
12-12 09:24:25.899: E/InputDispatcher(81): Received spurious receive callback for unknown input channel. fd=166, events=0x8
12-12 09:24:25.899: E/InputDispatcher(81): Received spurious receive callback for unknown input channel. fd=171, events=0x8
12-12 09:24:25.899: E/InputDispatcher(81): Received spurious receive callback for unknown input channel. fd=174, events=0x8
12-12 09:24:25.899: E/InputDispatcher(81): Received spurious receive callback for unknown input channel. fd=175, events=0x8
12-12 09:24:25.899: E/InputDispatcher(81): channel '406dfd88 com.apia.selfnettest/com.apia.selfnettest.MainClass (server)' ~ Consumer closed input channel or an error occurred. events=0x8
12-12 09:24:25.899: E/InputDispatcher(81): channel '406dfd88 com.apia.selfnettest/com.apia.selfnettest.MainClass (server)' ~ Channel is unrecoverably broken and will be disposed!
12-12 09:24:25.961: I/WindowManager(81): WIN DEATH: Window{407713a0 com.apia.selfnettest/com.apia.selfnettest.MainClass paused=false}
12-12 09:24:25.979: I/WindowManager(81): WIN DEATH: Window{409345c0 com.apia.selfnettest/com.apia.selfnettest.MainClass paused=false}
12-12 09:24:26.090: I/WindowManager(81): WIN DEATH: Window{408ab168 com.apia.selfnettest/com.apia.selfnettest.MainClass paused=false}
12-12 09:24:26.130: I/WindowManager(81): WIN DEATH: Window{40892f20 com.apia.selfnettest/com.apia.selfnettest.MainClass paused=false}
12-12 09:24:26.171: I/WindowManager(81): WIN DEATH: Window{406dfd88 com.apia.selfnettest/com.apia.selfnettest.MainClass paused=false}
12-12 09:24:26.199: W/WindowManager(81): Failed looking up window
12-12 09:24:26.199: W/WindowManager(81): java.lang.IllegalArgumentException: Requested window android.os.BinderProxy@407da2c8 does not exist
12-12 09:24:26.199: W/WindowManager(81): at com.android.server.WindowManagerService.windowForClientLocked(WindowManagerService.java:8174)
12-12 09:24:26.199: W/WindowManager(81): at com.android.server.WindowManagerService.windowForClientLocked(WindowManagerService.java:8165)
12-12 09:24:26.199: W/WindowManager(81): at com.android.server.WindowManagerService$WindowState$DeathRecipient.binderDied(WindowManagerService.java:7024)
12-12 09:24:26.199: W/WindowManager(81): at android.os.BinderProxy.sendDeathNotice(Binder.java:381)
12-12 09:24:26.199: W/WindowManager(81): at dalvik.system.NativeStart.run(Native Method)
12-12 09:24:26.199: I/WindowManager(81): WIN DEATH: null
12-12 09:24:26.199: I/WindowManager(81): WIN DEATH: Window{4093bfb0 com.apia.selfnettest/com.apia.selfnettest.MainClass paused=false}
12-12 09:24:26.260: I/WindowManager(81): WIN DEATH: Window{408d2a28 com.apia.selfnettest/com.apia.selfnettest.MainClass paused=false}
12-12 09:24:26.300: I/WindowManager(81): WIN DEATH: Window{408a49e8 com.apia.selfnettest/com.apia.selfnettest.MainClass paused=false}
12-12 09:24:26.311: I/WindowManager(81): WIN DEATH: Window{40884570 com.apia.selfnettest/com.apia.selfnettest.MainClass paused=false}
12-12 09:24:26.319: E/InputDispatcher(81): Received spurious receive callback for unknown input channel. fd=181, events=0x8
12-12 09:24:26.330: E/InputDispatcher(81): Received spurious receive callback for unknown input channel. fd=184, events=0x8
12-12 09:24:26.330: E/InputDispatcher(81): Received spurious receive callback for unknown input channel. fd=187, events=0x8
12-12 09:24:26.330: E/InputDispatcher(81): Received spurious receive callback for unknown input channel. fd=190, events=0x8
12-12 09:24:26.330: E/InputDispatcher(81): Received spurious receive callback for unknown input channel. fd=195, events=0x8
12-12 09:24:26.330: E/InputDispatcher(81): Received spurious receive callback for unknown input channel. fd=196, events=0x8
12-12 09:24:26.330: E/InputDispatcher(81): Received spurious receive callback for unknown input channel. fd=198, events=0x8
12-12 09:24:26.330: E/InputDispatcher(81): Received spurious receive callback for unknown input channel. fd=202, events=0x8
12-12 09:24:26.330: I/InputDispatcher(81): Dropping event because there is no touched window or focused application.
12-12 09:24:26.330: I/InputDispatcher(81): Dropping event because there is no touched window or focused application.
12-12 09:24:26.340: I/InputDispatcher(81): Dropping event because there is no touched window or focused application.
12-12 09:24:26.340: I/InputDispatcher(81): Dropping event because there is no touched window or focused application.
12-12 09:24:26.340: I/InputDispatcher(81): Dropping event because there is no touched window or focused application.
12-12 09:24:26.340: I/InputDispatcher(81): Dropping event because there is no touched window or focused application.
12-12 09:24:26.340: I/InputDispatcher(81): Dropping event because there is no touched window or focused application.
12-12 09:24:26.349: I/InputDispatcher(81): Dropping event because there is no touched window or focused application.
12-12 09:24:26.349: I/InputDispatcher(81): Dropping event because there is no touched window or focused application.
12-12 09:24:26.349: I/InputDispatcher(81): Dropping event because there is no touched window or focused application.
12-12 09:24:26.349: I/InputDispatcher(81): Dropping event because there is no touched window or focused application.
12-12 09:24:26.349: I/InputDispatcher(81): Dropping event because there is no touched window or focused application.
12-12 09:24:26.349: I/InputDispatcher(81): Dropping event because there is no touched window or focused application.
12-12 09:24:26.359: I/InputDispatcher(81): Dropping event because there is no touched window or focused application.
12-12 09:24:26.359: I/InputDispatcher(81): Dropping event because there is no touched window or focused application.
12-12 09:24:26.359: I/InputDispatcher(81): Dropping event because there is no touched window or focused application.
12-12 09:24:26.359: I/InputDispatcher(81): Dropping event because there is no touched window or focused application.
12-12 09:24:26.380: I/InputDispatcher(81): Dropping event because there is no touched window or focused application.
12-12 09:24:26.380: I/InputDispatcher(81): Dropping event because there is no touched window or focused application.
12-12 09:24:26.380: I/InputDispatcher(81): Dropping event because there is no touched window or focused application.
12-12 09:24:26.539: I/InputDispatcher(81): Dropping event because there is no touched window or focused application.
12-12 09:24:26.630: I/jdwp(520): Ignoring second debugger -- accepting and dropping
12-12 09:24:27.030: D/AndroidRuntime(520): Shutting down VM
12-12 09:24:27.030: W/dalvikvm(520): threadid=1: thread exiting with uncaught exception (group=0x40015560)
12-12 09:24:27.050: E/AndroidRuntime(520): FATAL EXCEPTION: main
12-12 09:24:27.050: E/AndroidRuntime(520): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.apia.selfnettest/com.apia.selfnettest.MainClass}: java.lang.NullPointerException
12-12 09:24:27.050: E/AndroidRuntime(520): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1647)
12-12 09:24:27.050: E/AndroidRuntime(520): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
12-12 09:24:27.050: E/AndroidRuntime(520): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
12-12 09:24:27.050: E/AndroidRuntime(520): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
12-12 09:24:27.050: E/AndroidRuntime(520): at android.os.Handler.dispatchMessage(Handler.java:99)
12-12 09:24:27.050: E/AndroidRuntime(520): at android.os.Looper.loop(Looper.java:130)
12-12 09:24:27.050: E/AndroidRuntime(520): at android.app.ActivityThread.main(ActivityThread.java:3683)
12-12 09:24:27.050: E/AndroidRuntime(520): at java.lang.reflect.Method.invokeNative(Native Method)
12-12 09:24:27.050: E/AndroidRuntime(520): at java.lang.reflect.Method.invoke(Method.java:507)
12-12 09:24:27.050: E/AndroidRuntime(520): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
12-12 09:24:27.050: E/AndroidRuntime(520): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
12-12 09:24:27.050: E/AndroidRuntime(520): at dalvik.system.NativeStart.main(Native Method)
12-12 09:24:27.050: E/AndroidRuntime(520): Caused by: java.lang.NullPointerException
12-12 09:24:27.050: E/AndroidRuntime(520): at com.apia.utils.LibLayout.determineScreenDensity(LibLayout.java:1273)
12-12 09:24:27.050: E/AndroidRuntime(520): at com.apia.utils.LibLayout.isXLargeLayout(LibLayout.java:1310)
12-12 09:24:27.050: E/AndroidRuntime(520): at com.apia.selfnettest.MainClass.onCreate(MainClass.java:191)
12-12 09:24:27.050: E/AndroidRuntime(520): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
12-12 09:24:27.050: E/AndroidRuntime(520): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
12-12 09:24:27.050: E/AndroidRuntime(520): ... 11 more
12-12 09:24:27.059: W/ActivityManager(81): Force finishing activity com.apia.selfnettest/.MainClass
12-12 09:24:27.580: W/ActivityManager(81): Activity pause timeout for HistoryRecord{4071c7f0 com.apia.selfnettest/.MainClass}
12-12 09:24:30.865: W/ActivityManager(81): Launch timeout has expired, giving up wake lock!
これはエラーを生成する関数です:
public static int determineScreenDensity() {
//0: low density
//1: medium density
//2: high density
DisplayMetrics metrics = new DisplayMetrics();
((Activity) LibBanking.AppContext).getWindowManager().getDefaultDisplay().getMetrics(metrics);
int density = metrics.densityDpi;
if (density==DisplayMetrics.DENSITY_XHIGH) {
return 3;
}
else if (density==DisplayMetrics.DENSITY_HIGH) {
return 2;
}
else if (density==DisplayMetrics.DENSITY_MEDIUM) {
return 1;
}
else if (density==DisplayMetrics.DENSITY_LOW) {
return 0;
}
else {
return 1;
}
}
そして、それぞれが次のようにLibBanking.AppContext
設定されていることに注意してください。activity
LibBanking.AppContext = this;
前もって感謝します....