I am developing a game using Cocos2d FrameWork in Android.

I encountered a problem while testing on Motorola Xoom.

What I want to do :

  • When User pressed Volume up and Volume down Button. All the Animation should play with sound .

But What actually Happened:

  • When I pressed volume up down button on Motorola Xoom than My Game Lost Focus and all Animation Paused but sound is playing according to the volume button settings.

This is only when I test my Application in Honey Comb OS.

I am using onWindowFocusChanged method to Resume Game Play.

Anyone having encounter this type of problem ?
Please let me know if anyone have solution for this .

Thanks.

有帮助吗?

解决方案

i found answer myself ..

Here is the solution of this issue ..

public void onWindowFocusChanged(boolean hasFocus) 
{
    synchronized(sGLThreadManager) {
    //mHasFocus = hasFocus;
    mHasFocus = true;
    sGLThreadManager.notifyAll();
    }
    if (LOG_SURFACE) 
    {
        Log.i("Main thread", "Focus " + (mHasFocus ? "gained" : "lost"));
    }
}

just change mHasFocus = true in GLSurfaceView class of Cocos2d android ...

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top