views:

39

answers:

0

I have an activity with GLSurfaseView as content. I must do that view invisible on Back button pressed. I hold onKey method and, how it seems to me, make all as need. Code is here: public boolean onKey(View v, int keyCode, KeyEvent event) { return super.onKeyDown(keyCode, event); }

@Override
public boolean onKeyDown(int keyCode, KeyEvent event)
{
    if ( (keyCode == KeyEvent.KEYCODE_BACK))
    {
        nativePauseDraw();
        showDialog();
        System.out.println("invisible");
        mGLView.setVisibility(GLSurfaceView.INVISIBLE);
    }
    return false;        
}

strange things have place here:when my testing smartphone is in portrait mode, the view doesn't become invisible, though, if then there is no call setVisibility(View.VISIBLE) it doesn't react at all. But when my phone is in landscape mode the screen becomes black, as it must be. What are the differents in this two cases? I have no idea.