1)  Don't override home.  That key should always work to get the user
back home.
2)  Make sure you're overriding onPause and onResume in your activity
and you have those calling pause and resume in GL.  Normally I'd say
just have it call that on your GLSurfaceView but I'm not sure how the
configuration works for you being that you're using mostly native
code.

On Nov 8, 3:59 pm, Illidane <illid...@gmail.com> wrote:
> Hello!
> I'm writing my opengl native game. Menu is using android api, game
> field using native lib ( c++ and opengl ). All in one activity
> ( different views ).
> If I press Back or Home button ( without overriting onKeyDown() ) all
> is fine: game just quit to desktop and when I again running, it saving
> its state. But I was needed to overrite Back and Menu button:
>
>  public boolean onKeyDown(int keyCode, KeyEvent event)
>   {
>             super.onKeyDown(keyCode, event);
>
>         if(keyCode == KeyEvent.KEYCODE_MENU || keyCode ==
> KeyEvent.KEYCODE_BACK)
>         {
>               // some code
>
>          return true;
>         }
>
>         return false;
>   }
>
> Than I quit throught Home button and again run it. Sometimes all is
> fine, but sometimes I see only my menu, and black screen where the
> opengl must be. What's the problem?
> Also I was trying to overrite Home button, but seems it's impossible..
> Help me please.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to