活动无法启动

时间:2013-01-16 16:18:58

标签: android android-activity

我使用此代码从我的MainMenu开始一个新游戏,一切正常但是当游戏结束时,用户会得到一个弹出窗口(只有另一个名为GameFinished的活动{{1} })。用户可以选择是否要再次玩游戏或返回Theme.Dialog。这也可以正常工作,但当我开始另一个游戏时,MainMenu的活动没有任何反应,调试器显示该行已执行。

视觉指南:

A - > B - > C --finish - > B - finish - >一个

之后我不能这样:

A - >乙

MainMenu

我在几周内添加的唯一内容是这一行,所以我Tapifier会起作用:

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));
                    }
                }

这是我的(非常大的)logcat:

StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder()
        .permitAll().build();

StrictMode.setThreadPolicy(policy);

SimpleMath:

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)

PlayAgain(游戏结束后接听电话):

@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();
    }

}

唯一相关的其他事情是我使用AsyncTask和Handler。

2 个答案:

答案 0 :(得分:5)

ObAt,我在我的应用程序中有完全相同的错误。你写道你不使用IntentReceiver,但它可能不是真的。

似乎你正在使用三星设备的特殊功能--MultiWindow,所以如果你在你的清单中注册了intent-filter,就像我一样:

    <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
        <!-- SAMSUNG MULTI-WINDOW -->
        <category android:name="android.intent.category.MULTIWINDOW_LAUNCHER" />
    </intent-filter>

    <!-- SAMSUNG MULTI-WINDOW -->   
    <meta-data android:name="com.sec.minimode.icon.portrait.normal"
        android:resource="@drawable/ic_launcher" />
    <meta-data android:name="com.sec.minimode.icon.landscape.normal"
        android:resource="@drawable/ic_launcher" />

然后可能三星设备在其背景上注册IntentReceiver以正确处理与MultiWindow功能相关的一些任务。我在日志中看到这个错误几个月,它从来没有任何问题。所以我忽略了这一点,直到三星解决这个问题。这就是我的看法

答案 1 :(得分:0)

根据您的错误,您正在泄漏之前注册过的IntentReceiver。

您需要取消注册IntentReceiver,onPause方法可以为您的SimpleMath活动执行此操作。

@Override
protected void onPause() {
    super.onPause();
    unregister(); //  here
}