在播放高记忆游戏时将应用程序带到前台时应用程序崩溃

时间:2015-03-17 07:26:19

标签: android android-fragments android-lifecycle

我的应用程序出现了问题。

当我在播放像Asphalt 8这样的高内存消耗游戏时,我将应用程序从背景带到前台,应用程序崩溃了。 只有当我玩像Asphalt 8 这样的高内存应用时才会发生这种情况。由于活动上下文变为空,因此发生了崩溃。

我不知道如何解决这个问题。是否有人知道如何解决这个问题的解决方案。

提前致谢:)

更新

logcat的:

  7927-7927/com.xxxxx.android.beta E/AndroidRuntime﹕ FATAL EXCEPTION: main
    Process: com.xxxxxx.android.beta, PID: 7927
    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.xxxxxx.android.beta/com.xxxxxxxxx.android.Login.InitialScreen}: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Object android.content.Context.getSystemService(java.lang.String)' on a null object reference
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2314)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2388)
            at android.app.ActivityThread.access$800(ActivityThread.java:148)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1292)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:135)
            at android.app.ActivityThread.main(ActivityThread.java:5312)
            at java.lang.reflect.Method.invoke(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:372)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:901)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:696)
     Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Object android.content.Context.getSystemService(java.lang.String)' on a null object reference
            at com.xxxxxxxx.android.Login.SwipeFragment_Second.onCreateView(SwipeFragment_Second.java:42)
            at android.support.v4.app.Fragment.performCreateView(Fragment.java:1786)
            at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:947)
            at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1126)
            at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1108)
            at android.support.v4.app.FragmentManagerImpl.dispatchActivityCreated(FragmentManager.java:1917)
            at android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:544)
            at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1243)
            at android.app.Activity.performStart(Activity.java:5969)
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2277)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2388)
            at android.app.ActivityThread.access$800(ActivityThread.java:148)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1292)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:135)
            at android.app.ActivityThread.main(ActivityThread.java:5312)
            at java.lang.reflect.Method.invoke(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:372)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:901)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:696)
03-17 13:38:48.531    7927-7954/com.xxxxxxxxx.android.beta I/Fabric﹕ Crashlytics report upload complete: 

0 个答案:

没有答案