このコードを使用してMainMenu
、から新しいゲームを開始します。すべてが正常に機能しますが、ゲームが終了すると、ユーザーはポップアップウィンドウ(で名前が付けられた別のアクティビティ)を取得しGameFinished
ますTheme.Dialog
。ユーザーは、ゲームをもう一度プレイするか、に戻るかを選択できますMainMenu
。これも正常に機能しますが、何も起こらない状態から別のゲームを開始するMainMenu
と、デバッガーは行が実行されたことを示します。
ビジュアルガイド:
A-> B-> C --finish-> B --finish-> A
その後、私はこれを行うことはできません:
A-> B
public void onItemClick(AdapterView<?> parent, View view,
int position, long id) {
if (id == 0) {
startActivity(new Intent(GameMenu.this, GuessFlag.class));
} else if (id == 1) {
startActivity(new Intent(GameMenu.this,
MovieQuestions.class));
} else if (id == 2) {
startActivity(new Intent(GameMenu.this, SimpleMath.class));
} else if (id == 3) {
startActivity(new Intent(GameMenu.this, TickTacToe.class));
}
}
数週間で追加したのはこの行だけだったので、I Tapifierは機能します:
StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder()
.permitAll().build();
StrictMode.setThreadPolicy(policy);
これは私の(非常に大きな)logcatです:
01-16 17:17:28.845: E/ActivityThread(9311): Activity com.obattech.twoplayergame.games.MovieQuestions has leaked IntentReceiver com.android.internal.policy.impl.multiwindow.MultiPhoneWindowEvent$1@42342078 that was originally registered here. Are you missing a call to unregisterReceiver()?
01-16 17:17:28.845: E/ActivityThread(9311): android.app.IntentReceiverLeaked: Activity com.obattech.twoplayergame.games.MovieQuestions has leaked IntentReceiver com.android.internal.policy.impl.multiwindow.MultiPhoneWindowEvent$1@42342078 that was originally registered here. Are you missing a call to unregisterReceiver()?
01-16 17:17:28.845: E/ActivityThread(9311): at android.app.LoadedApk$ReceiverDispatcher.<init>(LoadedApk.java:792)
01-16 17:17:28.845: E/ActivityThread(9311): at android.app.LoadedApk.getReceiverDispatcher(LoadedApk.java:593)
01-16 17:17:28.845: E/ActivityThread(9311): at android.app.ContextImpl.registerReceiverInternal(ContextImpl.java:1254)
01-16 17:17:28.845: E/ActivityThread(9311): at android.app.ContextImpl.registerReceiver(ContextImpl.java:1241)
01-16 17:17:28.845: E/ActivityThread(9311): at android.app.ContextImpl.registerReceiver(ContextImpl.java:1235)
01-16 17:17:28.845: E/ActivityThread(9311): at android.content.ContextWrapper.registerReceiver(ContextWrapper.java:372)
01-16 17:17:28.845: E/ActivityThread(9311): at com.android.internal.policy.impl.multiwindow.MultiPhoneWindowEvent.<init>(MultiPhoneWindowEvent.java:332)
01-16 17:17:28.845: E/ActivityThread(9311): at com.android.internal.policy.impl.multiwindow.MultiPhoneWindowEvent.installDecor(MultiPhoneWindowEvent.java:176)
01-16 17:17:28.845: E/ActivityThread(9311): at java.lang.reflect.Method.invokeNative(Native Method)
01-16 17:17:28.845: E/ActivityThread(9311): at java.lang.reflect.Method.invoke(Method.java:511)
01-16 17:17:28.845: E/ActivityThread(9311): at com.android.internal.policy.impl.PhoneWindow.installDecor(PhoneWindow.java:3175)
01-16 17:17:28.845: E/ActivityThread(9311): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:304)
01-16 17:17:28.845: E/ActivityThread(9311): at android.app.Activity.setContentView(Activity.java:1924)
01-16 17:17:28.845: E/ActivityThread(9311): at com.obattech.twoplayergame.games.MovieQuestions.onCreate(MovieQuestions.java:45)
01-16 17:17:28.845: E/ActivityThread(9311): at android.app.Activity.performCreate(Activity.java:5206)
01-16 17:17:28.845: E/ActivityThread(9311): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1083)
01-16 17:17:28.845: E/ActivityThread(9311): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2064)
01-16 17:17:28.845: E/ActivityThread(9311): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2125)
01-16 17:17:28.845: E/ActivityThread(9311): at android.app.ActivityThread.access$600(ActivityThread.java:140)
01-16 17:17:28.845: E/ActivityThread(9311): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1227)
01-16 17:17:28.845: E/ActivityThread(9311): at android.os.Handler.dispatchMessage(Handler.java:99)
01-16 17:17:28.845: E/ActivityThread(9311): at android.os.Looper.loop(Looper.java:137)
01-16 17:17:28.845: E/ActivityThread(9311): at android.app.ActivityThread.main(ActivityThread.java:4898)
01-16 17:17:28.845: E/ActivityThread(9311): at java.lang.reflect.Method.invokeNative(Native Method)
01-16 17:17:28.845: E/ActivityThread(9311): at java.lang.reflect.Method.invoke(Method.java:511)
01-16 17:17:28.845: E/ActivityThread(9311): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1006)
01-16 17:17:28.845: E/ActivityThread(9311): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:773)
01-16 17:17:28.845: E/ActivityThread(9311): at dalvik.system.NativeStart.main(Native Method)
01-16 17:17:29.900: E/ActivityThread(9311): Activity com.obattech.twoplayergame.games.SimpleMath has leaked IntentReceiver com.android.internal.policy.impl.multiwindow.MultiPhoneWindowEvent$1@423555f8 that was originally registered here. Are you missing a call to unregisterReceiver()?
01-16 17:17:29.900: E/ActivityThread(9311): android.app.IntentReceiverLeaked: Activity com.obattech.twoplayergame.games.SimpleMath has leaked IntentReceiver com.android.internal.policy.impl.multiwindow.MultiPhoneWindowEvent$1@423555f8 that was originally registered here. Are you missing a call to unregisterReceiver()?
01-16 17:17:29.900: E/ActivityThread(9311): at android.app.LoadedApk$ReceiverDispatcher.<init>(LoadedApk.java:792)
01-16 17:17:29.900: E/ActivityThread(9311): at android.app.LoadedApk.getReceiverDispatcher(LoadedApk.java:593)
01-16 17:17:29.900: E/ActivityThread(9311): at android.app.ContextImpl.registerReceiverInternal(ContextImpl.java:1254)
01-16 17:17:29.900: E/ActivityThread(9311): at android.app.ContextImpl.registerReceiver(ContextImpl.java:1241)
01-16 17:17:29.900: E/ActivityThread(9311): at android.app.ContextImpl.registerReceiver(ContextImpl.java:1235)
01-16 17:17:29.900: E/ActivityThread(9311): at android.content.ContextWrapper.registerReceiver(ContextWrapper.java:372)
01-16 17:17:29.900: E/ActivityThread(9311): at com.android.internal.policy.impl.multiwindow.MultiPhoneWindowEvent.<init>(MultiPhoneWindowEvent.java:332)
01-16 17:17:29.900: E/ActivityThread(9311): at com.android.internal.policy.impl.multiwindow.MultiPhoneWindowEvent.installDecor(MultiPhoneWindowEvent.java:176)
01-16 17:17:29.900: E/ActivityThread(9311): at java.lang.reflect.Method.invokeNative(Native Method)
01-16 17:17:29.900: E/ActivityThread(9311): at java.lang.reflect.Method.invoke(Method.java:511)
01-16 17:17:29.900: E/ActivityThread(9311): at com.android.internal.policy.impl.PhoneWindow.installDecor(PhoneWindow.java:3175)
01-16 17:17:29.900: E/ActivityThread(9311): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:304)
01-16 17:17:29.900: E/ActivityThread(9311): at android.app.Activity.setContentView(Activity.java:1924)
01-16 17:17:29.900: E/ActivityThread(9311): at com.obattech.twoplayergame.games.SimpleMath.onCreate(SimpleMath.java:46)
01-16 17:17:29.900: E/ActivityThread(9311): at android.app.Activity.performCreate(Activity.java:5206)
01-16 17:17:29.900: E/ActivityThread(9311): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1083)
01-16 17:17:29.900: E/ActivityThread(9311): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2064)
01-16 17:17:29.900: E/ActivityThread(9311): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2125)
01-16 17:17:29.900: E/ActivityThread(9311): at android.app.ActivityThread.access$600(ActivityThread.java:140)
01-16 17:17:29.900: E/ActivityThread(9311): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1227)
01-16 17:17:29.900: E/ActivityThread(9311): at android.os.Handler.dispatchMessage(Handler.java:99)
01-16 17:17:29.900: E/ActivityThread(9311): at android.os.Looper.loop(Looper.java:137)
01-16 17:17:29.900: E/ActivityThread(9311): at android.app.ActivityThread.main(ActivityThread.java:4898)
01-16 17:17:29.900: E/ActivityThread(9311): at java.lang.reflect.Method.invokeNative(Native Method)
01-16 17:17:29.900: E/ActivityThread(9311): at java.lang.reflect.Method.invoke(Method.java:511)
01-16 17:17:29.900: E/ActivityThread(9311): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1006)
01-16 17:17:29.900: E/ActivityThread(9311): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:773)
01-16 17:17:29.900: E/ActivityThread(9311): at dalvik.system.NativeStart.main(Native Method)
01-16 17:17:30.520: E/ActivityThread(9311): Activity com.obattech.twoplayergame.games.MovieQuestions has leaked IntentReceiver com.android.internal.policy.impl.multiwindow.MultiPhoneWindowEvent$1@4294f240 that was originally registered here. Are you missing a call to unregisterReceiver()?
01-16 17:17:30.520: E/ActivityThread(9311): android.app.IntentReceiverLeaked: Activity com.obattech.twoplayergame.games.MovieQuestions has leaked IntentReceiver com.android.internal.policy.impl.multiwindow.MultiPhoneWindowEvent$1@4294f240 that was originally registered here. Are you missing a call to unregisterReceiver()?
01-16 17:17:30.520: E/ActivityThread(9311): at android.app.LoadedApk$ReceiverDispatcher.<init>(LoadedApk.java:792)
01-16 17:17:30.520: E/ActivityThread(9311): at android.app.LoadedApk.getReceiverDispatcher(LoadedApk.java:593)
01-16 17:17:30.520: E/ActivityThread(9311): at android.app.ContextImpl.registerReceiverInternal(ContextImpl.java:1254)
01-16 17:17:30.520: E/ActivityThread(9311): at android.app.ContextImpl.registerReceiver(ContextImpl.java:1241)
01-16 17:17:30.520: E/ActivityThread(9311): at android.app.ContextImpl.registerReceiver(ContextImpl.java:1235)
01-16 17:17:30.520: E/ActivityThread(9311): at android.content.ContextWrapper.registerReceiver(ContextWrapper.java:372)
01-16 17:17:30.520: E/ActivityThread(9311): at com.android.internal.policy.impl.multiwindow.MultiPhoneWindowEvent.<init>(MultiPhoneWindowEvent.java:332)
01-16 17:17:30.520: E/ActivityThread(9311): at com.android.internal.policy.impl.multiwindow.MultiPhoneWindowEvent.installDecor(MultiPhoneWindowEvent.java:176)
01-16 17:17:30.520: E/ActivityThread(9311): at java.lang.reflect.Method.invokeNative(Native Method)
01-16 17:17:30.520: E/ActivityThread(9311): at java.lang.reflect.Method.invoke(Method.java:511)
01-16 17:17:30.520: E/ActivityThread(9311): at com.android.internal.policy.impl.PhoneWindow.installDecor(PhoneWindow.java:3175)
01-16 17:17:30.520: E/ActivityThread(9311): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:304)
01-16 17:17:30.520: E/ActivityThread(9311): at android.app.Activity.setContentView(Activity.java:1924)
01-16 17:17:30.520: E/ActivityThread(9311): at com.obattech.twoplayergame.games.MovieQuestions.onCreate(MovieQuestions.java:45)
01-16 17:17:30.520: E/ActivityThread(9311): at android.app.Activity.performCreate(Activity.java:5206)
01-16 17:17:30.520: E/ActivityThread(9311): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1083)
01-16 17:17:30.520: E/ActivityThread(9311): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2064)
01-16 17:17:30.520: E/ActivityThread(9311): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2125)
01-16 17:17:30.520: E/ActivityThread(9311): at android.app.ActivityThread.access$600(ActivityThread.java:140)
01-16 17:17:30.520: E/ActivityThread(9311): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1227)
01-16 17:17:30.520: E/ActivityThread(9311): at android.os.Handler.dispatchMessage(Handler.java:99)
01-16 17:17:30.520: E/ActivityThread(9311): at android.os.Looper.loop(Looper.java:137)
01-16 17:17:30.520: E/ActivityThread(9311): at android.app.ActivityThread.main(ActivityThread.java:4898)
01-16 17:17:30.520: E/ActivityThread(9311): at java.lang.reflect.Method.invokeNative(Native Method)
01-16 17:17:30.520: E/ActivityThread(9311): at java.lang.reflect.Method.invoke(Method.java:511)
01-16 17:17:30.520: E/ActivityThread(9311): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1006)
01-16 17:17:30.520: E/ActivityThread(9311): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:773)
01-16 17:17:30.520: E/ActivityThread(9311): at dalvik.system.NativeStart.main(Native Method)
01-16 17:17:30.825: E/ActivityThread(9311): Activity com.obattech.twoplayergame.games.GuessFlag has leaked IntentReceiver com.android.internal.policy.impl.multiwindow.MultiPhoneWindowEvent$1@4296a908 that was originally registered here. Are you missing a call to unregisterReceiver()?
01-16 17:17:30.825: E/ActivityThread(9311): android.app.IntentReceiverLeaked: Activity com.obattech.twoplayergame.games.GuessFlag has leaked IntentReceiver com.android.internal.policy.impl.multiwindow.MultiPhoneWindowEvent$1@4296a908 that was originally registered here. Are you missing a call to unregisterReceiver()?
01-16 17:17:30.825: E/ActivityThread(9311): at android.app.LoadedApk$ReceiverDispatcher.<init>(LoadedApk.java:792)
01-16 17:17:30.825: E/ActivityThread(9311): at android.app.LoadedApk.getReceiverDispatcher(LoadedApk.java:593)
01-16 17:17:30.825: E/ActivityThread(9311): at android.app.ContextImpl.registerReceiverInternal(ContextImpl.java:1254)
01-16 17:17:30.825: E/ActivityThread(9311): at android.app.ContextImpl.registerReceiver(ContextImpl.java:1241)
01-16 17:17:30.825: E/ActivityThread(9311): at android.app.ContextImpl.registerReceiver(ContextImpl.java:1235)
01-16 17:17:30.825: E/ActivityThread(9311): at android.content.ContextWrapper.registerReceiver(ContextWrapper.java:372)
01-16 17:17:30.825: E/ActivityThread(9311): at com.android.internal.policy.impl.multiwindow.MultiPhoneWindowEvent.<init>(MultiPhoneWindowEvent.java:332)
01-16 17:17:30.825: E/ActivityThread(9311): at com.android.internal.policy.impl.multiwindow.MultiPhoneWindowEvent.installDecor(MultiPhoneWindowEvent.java:176)
01-16 17:17:30.825: E/ActivityThread(9311): at java.lang.reflect.Method.invokeNative(Native Method)
01-16 17:17:30.825: E/ActivityThread(9311): at java.lang.reflect.Method.invoke(Method.java:511)
01-16 17:17:30.825: E/ActivityThread(9311): at com.android.internal.policy.impl.PhoneWindow.installDecor(PhoneWindow.java:3175)
01-16 17:17:30.825: E/ActivityThread(9311): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:304)
01-16 17:17:30.825: E/ActivityThread(9311): at android.app.Activity.setContentView(Activity.java:1924)
01-16 17:17:30.825: E/ActivityThread(9311): at com.obattech.twoplayergame.games.GuessFlag.onCreate(GuessFlag.java:46)
01-16 17:17:30.825: E/ActivityThread(9311): at android.app.Activity.performCreate(Activity.java:5206)
01-16 17:17:30.825: E/ActivityThread(9311): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1083)
01-16 17:17:30.825: E/ActivityThread(9311): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2064)
01-16 17:17:30.825: E/ActivityThread(9311): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2125)
01-16 17:17:30.825: E/ActivityThread(9311): at android.app.ActivityThread.access$600(ActivityThread.java:140)
01-16 17:17:30.825: E/ActivityThread(9311): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1227)
01-16 17:17:30.825: E/ActivityThread(9311): at android.os.Handler.dispatchMessage(Handler.java:99)
01-16 17:17:30.825: E/ActivityThread(9311): at android.os.Looper.loop(Looper.java:137)
01-16 17:17:30.825: E/ActivityThread(9311): at android.app.ActivityThread.main(ActivityThread.java:4898)
01-16 17:17:30.825: E/ActivityThread(9311): at java.lang.reflect.Method.invokeNative(Native Method)
01-16 17:17:30.825: E/ActivityThread(9311): at java.lang.reflect.Method.invoke(Method.java:511)
01-16 17:17:30.825: E/ActivityThread(9311): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1006)
01-16 17:17:30.825: E/ActivityThread(9311): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:773)
01-16 17:17:30.825: E/ActivityThread(9311): at dalvik.system.NativeStart.main(Native Method)
01-16 17:17:31.225: E/ActivityThread(9311): Activity com.obattech.twoplayergame.games.SimpleMath has leaked IntentReceiver com.android.internal.policy.impl.multiwindow.MultiPhoneWindowEvent$1@429858b0 that was originally registered here. Are you missing a call to unregisterReceiver()?
01-16 17:17:31.225: E/ActivityThread(9311): android.app.IntentReceiverLeaked: Activity com.obattech.twoplayergame.games.SimpleMath has leaked IntentReceiver com.android.internal.policy.impl.multiwindow.MultiPhoneWindowEvent$1@429858b0 that was originally registered here. Are you missing a call to unregisterReceiver()?
01-16 17:17:31.225: E/ActivityThread(9311): at android.app.LoadedApk$ReceiverDispatcher.<init>(LoadedApk.java:792)
01-16 17:17:31.225: E/ActivityThread(9311): at android.app.LoadedApk.getReceiverDispatcher(LoadedApk.java:593)
01-16 17:17:31.225: E/ActivityThread(9311): at android.app.ContextImpl.registerReceiverInternal(ContextImpl.java:1254)
01-16 17:17:31.225: E/ActivityThread(9311): at android.app.ContextImpl.registerReceiver(ContextImpl.java:1241)
01-16 17:17:31.225: E/ActivityThread(9311): at android.app.ContextImpl.registerReceiver(ContextImpl.java:1235)
01-16 17:17:31.225: E/ActivityThread(9311): at android.content.ContextWrapper.registerReceiver(ContextWrapper.java:372)
01-16 17:17:31.225: E/ActivityThread(9311): at com.android.internal.policy.impl.multiwindow.MultiPhoneWindowEvent.<init>(MultiPhoneWindowEvent.java:332)
01-16 17:17:31.225: E/ActivityThread(9311): at com.android.internal.policy.impl.multiwindow.MultiPhoneWindowEvent.installDecor(MultiPhoneWindowEvent.java:176)
01-16 17:17:31.225: E/ActivityThread(9311): at java.lang.reflect.Method.invokeNative(Native Method)
01-16 17:17:31.225: E/ActivityThread(9311): at java.lang.reflect.Method.invoke(Method.java:511)
01-16 17:17:31.225: E/ActivityThread(9311): at com.android.internal.policy.impl.PhoneWindow.installDecor(PhoneWindow.java:3175)
01-16 17:17:31.225: E/ActivityThread(9311): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:304)
01-16 17:17:31.225: E/ActivityThread(9311): at android.app.Activity.setContentView(Activity.java:1924)
01-16 17:17:31.225: E/ActivityThread(9311): at com.obattech.twoplayergame.games.SimpleMath.onCreate(SimpleMath.java:46)
01-16 17:17:31.225: E/ActivityThread(9311): at android.app.Activity.performCreate(Activity.java:5206)
01-16 17:17:31.225: E/ActivityThread(9311): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1083)
01-16 17:17:31.225: E/ActivityThread(9311): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2064)
01-16 17:17:31.225: E/ActivityThread(9311): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2125)
01-16 17:17:31.225: E/ActivityThread(9311): at android.app.ActivityThread.access$600(ActivityThread.java:140)
01-16 17:17:31.225: E/ActivityThread(9311): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1227)
01-16 17:17:31.225: E/ActivityThread(9311): at android.os.Handler.dispatchMessage(Handler.java:99)
01-16 17:17:31.225: E/ActivityThread(9311): at android.os.Looper.loop(Looper.java:137)
01-16 17:17:31.225: E/ActivityThread(9311): at android.app.ActivityThread.main(ActivityThread.java:4898)
01-16 17:17:31.225: E/ActivityThread(9311): at java.lang.reflect.Method.invokeNative(Native Method)
01-16 17:17:31.225: E/ActivityThread(9311): at java.lang.reflect.Method.invoke(Method.java:511)
01-16 17:17:31.225: E/ActivityThread(9311): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1006)
01-16 17:17:31.225: E/ActivityThread(9311): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:773)
01-16 17:17:31.225: E/ActivityThread(9311): at dalvik.system.NativeStart.main(Native Method)
01-16 17:17:31.500: E/ActivityThread(9311): Activity com.obattech.twoplayergame.games.GuessFlag has leaked IntentReceiver com.android.internal.policy.impl.multiwindow.MultiPhoneWindowEvent$1@429a0de0 that was originally registered here. Are you missing a call to unregisterReceiver()?
01-16 17:17:31.500: E/ActivityThread(9311): android.app.IntentReceiverLeaked: Activity com.obattech.twoplayergame.games.GuessFlag has leaked IntentReceiver com.android.internal.policy.impl.multiwindow.MultiPhoneWindowEvent$1@429a0de0 that was originally registered here. Are you missing a call to unregisterReceiver()?
01-16 17:17:31.500: E/ActivityThread(9311): at android.app.LoadedApk$ReceiverDispatcher.<init>(LoadedApk.java:792)
01-16 17:17:31.500: E/ActivityThread(9311): at android.app.LoadedApk.getReceiverDispatcher(LoadedApk.java:593)
01-16 17:17:31.500: E/ActivityThread(9311): at android.app.ContextImpl.registerReceiverInternal(ContextImpl.java:1254)
01-16 17:17:31.500: E/ActivityThread(9311): at android.app.ContextImpl.registerReceiver(ContextImpl.java:1241)
01-16 17:17:31.500: E/ActivityThread(9311): at android.app.ContextImpl.registerReceiver(ContextImpl.java:1235)
01-16 17:17:31.500: E/ActivityThread(9311): at android.content.ContextWrapper.registerReceiver(ContextWrapper.java:372)
01-16 17:17:31.500: E/ActivityThread(9311): at com.android.internal.policy.impl.multiwindow.MultiPhoneWindowEvent.<init>(MultiPhoneWindowEvent.java:332)
01-16 17:17:31.500: E/ActivityThread(9311): at com.android.internal.policy.impl.multiwindow.MultiPhoneWindowEvent.installDecor(MultiPhoneWindowEvent.java:176)
01-16 17:17:31.500: E/ActivityThread(9311): at java.lang.reflect.Method.invokeNative(Native Method)
01-16 17:17:31.500: E/ActivityThread(9311): at java.lang.reflect.Method.invoke(Method.java:511)
01-16 17:17:31.500: E/ActivityThread(9311): at com.android.internal.policy.impl.PhoneWindow.installDecor(PhoneWindow.java:3175)
01-16 17:17:31.500: E/ActivityThread(9311): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:304)
01-16 17:17:31.500: E/ActivityThread(9311): at android.app.Activity.setContentView(Activity.java:1924)
01-16 17:17:31.500: E/ActivityThread(9311): at com.obattech.twoplayergame.games.GuessFlag.onCreate(GuessFlag.java:46)
01-16 17:17:31.500: E/ActivityThread(9311): at android.app.Activity.performCreate(Activity.java:5206)
01-16 17:17:31.500: E/ActivityThread(9311): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1083)
01-16 17:17:31.500: E/ActivityThread(9311): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2064)
01-16 17:17:31.500: E/ActivityThread(9311): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2125)
01-16 17:17:31.500: E/ActivityThread(9311): at android.app.ActivityThread.access$600(ActivityThread.java:140)
01-16 17:17:31.500: E/ActivityThread(9311): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1227)
01-16 17:17:31.500: E/ActivityThread(9311): at android.os.Handler.dispatchMessage(Handler.java:99)
01-16 17:17:31.500: E/ActivityThread(9311): at android.os.Looper.loop(Looper.java:137)
01-16 17:17:31.500: E/ActivityThread(9311): at android.app.ActivityThread.main(ActivityThread.java:4898)
01-16 17:17:31.500: E/ActivityThread(9311): at java.lang.reflect.Method.invokeNative(Native Method)
01-16 17:17:31.500: E/ActivityThread(9311): at java.lang.reflect.Method.invoke(Method.java:511)
01-16 17:17:31.500: E/ActivityThread(9311): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1006)
01-16 17:17:31.500: E/ActivityThread(9311): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:773)
01-16 17:17:31.500: E/ActivityThread(9311): at dalvik.system.NativeStart.main(Native Method)
SimpleMath:
@Override
protected void onCreate(Bundle savedInstanceState) {
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_game_simpemath);
}
protected void onResume() {
super.onResume();
if (AppData.questionsLoaded) {
AppData.questionsLoaded = false;
runGame();
}
if (AppData.restartGame) {
AppData.restartGame = false;
finish();
startActivity(new Intent(SimpleMath.this, TickTacToe.class));
}
if(AppData.finishMe){
finish();
}
}
PlayAgain(ゲーム終了時に電話を受ける):
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.activity_game_gamefinished);
Window window = this.getWindow();
window.setFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL,
WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL);
android.view.WindowManager.LayoutParams params = getWindow()
.getAttributes();
params.width = android.view.WindowManager.LayoutParams.MATCH_PARENT;
getWindow().setAttributes(
(android.view.WindowManager.LayoutParams) params);
setListeners();
}
public void setListeners() {
button_restart.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
AppData.restartGame = true;
finish();
}
});
button_mainmenu.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
AppData.finishMe = true;
finish();
}
});
}
他に関連するのは、AsyncTaskとHandlerを使用することだけです。