1

Im developing a game for the kindle fire, the game always run with the bar hidden.

Only when the user enters to the pause menu the bar should appear , I only want that the bar shows up over the game.

But it seems that when the bar show up GlSurfaceView.getHeight() changes from 600 to 580, and my game resizes, but I dont want that behavior,

I just want that the bar shows up over the game and my game doesnt move , I've already tried with GlSurfaceView.setMinimumHeight(600);

but the kindle simply ignores that.

this is how my game always runs : enter image description here

and when i activate the bar this happens :

enter image description here

instead of this :

enter image description here

you know a way to avoid this?

Thanks!

To create the GlSurfaceView i do the following:

OnCreate() {

s_activity.m_view = new GameGLSurfaceView(s_activity.getApplication(), true, pixelSize,depthSize, stencilSize);

}

public GameGLSurfaceView(Context context, boolean translucent,int pixelSize, int depth, int stencil) 
{
super(context);
mRenderer = new GameRenderer(context, this);
setRenderer(mRenderer);

}

to Hide and show the bar i use this function

private static final int AMAZON_FLAG_NOSOFTKEYS = 0x80000000;
private static final int FLAG_SUPER_FULLSCREEN = AMAZON_FLAG_NOSOFTKEYS | WindowManager.LayoutParams.FLAG_FULLSCREEN;

public static void toggleKindleBar(final int toDo)
{   
    if( s_activity != null)
        s_activity.runOnUiThread(new Runnable()
        {
            public void run()
            {
                s_activity.getWindow().clearFlags( toDo!=1? WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN : FLAG_SUPER_FULLSCREEN);
                s_activity.getWindow().addFlags( toDo!=1? FLAG_SUPER_FULLSCREEN:WindowManager.LayoutParams.FLAG_FULLSCREEN);

            }
        });
}
elios264
  • 385
  • 2
  • 16

1 Answers1

1

possible solutions:

  1. try this on the onCreate() method of the activity:

    getWindow().setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);

    do note that according to my experience , the kindle fire has some weird problems with some views when they are used while this code runs , so even if it works , please do some extensive testing .

  2. try to set the manifest to have some flags for the configChanges, but i didn't tested it and i don't have the kindle fire anymore .

android developer
  • 114,585
  • 152
  • 739
  • 1,270
  • this are the flags for the activity config changes : android:configChanges="mcc|mnc|locale|touchscreen|keyboard|keyboardHidden|navigation|orientation|screenLayout|fontScale|uiMode" – elios264 May 29 '12 at 21:27