문제

when I am playing the game and I press the Home Key. The view is gone which is normal but when I start the game again a new game is started previous game is not resumed which is causing a lot of problem can any one help me with this issue?

도움이 되었습니까?

해결책

@Override
    public void onCreate(Bundle b)
    {
        super.onCreate(b);
            getWindow().addFlags(WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD);
            getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
            getWindow().addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED);
            getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
            WindowManager.LayoutParams.FLAG_FULLSCREEN);


    }

Doing this solved my problem

다른 팁

add android:configChanges="keyboardHidden|orientation" to your activity in AndroidManifest

You are probably creating a new instance of the game in an onResume method, so check all your lifecycle methods.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top