Couldn't you just 'eat' the back key, and use startActivity() to
launch home when you receive it? That should pretty much give you the
effect the effect you're looking for.
Of course, then your app is behaving in a nonstandard way, which might
confuse users, so you should ask yourself whether this is really what
you want to do.



On Tue, Sep 1, 2009 at 8:21 AM, Ne0<liamjamesalf...@googlemail.com> wrote:
>
> Trying to the do as the title describes with the following code, but
> it doesn't seem to work. It just does nothing once i have altered the
> keyCode. Do i have to do something to the event?
>
> public boolean onKeyDown(int keyCode, KeyEvent event) {
>        /*
>         *  The back key usually destroys the activity
>         *  without saving the instance. We want the
>         *  instance saved if the activity gets destroyed
>         *  so we are pretending its a home key press.
>         */
>
>        if(gLOG){Log.d(TAG,"onKeyDown");}
>        if(keyCode == KeyEvent.KEYCODE_BACK){
>                if(gLOG){Log.d(TAG,"KEYCODE_BACK " + keyCode);}
>
>                keyCode = KeyEvent.KEYCODE_HOME;
>        }
>        return super.onKeyDown(keyCode, event);
>    }
>
> Thanks for any help.
>
> Liam
> >
>

--~--~---------~--~----~------------~-------~--~----~
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