Well, I *think* you're using it wrong.
Basically, onKeyDown allows you to override the default key behavior for
whatever key is pressed.  So, if you return 'true' it means that you have
handled the behavior.

So, you have to provide your own code to navigate your activities/view if
you are overriding.
So, detect if you are in the main menu and that's the only time you'll
return super.onKeyDown() (basically let it handle the keydown itself.)

If it is pressed somewhere else, you have to return true and close the menu
or whatever yourself.

On Thu, Mar 10, 2011 at 5:02 PM, Colin <colin...@gmail.com> wrote:

> Thanks, but how do I implement onBackPressed?  My thread extending
> activity says there is no method to override.
>
> On Mar 10, 4:50 pm, Justin Anderson <magouyaw...@gmail.com> wrote:
> > Starting with Android 2.0 you also need to implement onBackPressed() in
> > order to achieve this...
> http://developer.android.com/reference/android/app/Activity.html#onBa...
> >
> > Thanks,
> > Justin Anderson
> > MagouyaWare Developerhttp://sites.google.com/site/magouyaware
> >
> > On Thu, Mar 10, 2011 at 2:36 PM, TreKing <treking...@gmail.com> wrote:
> > > On Thu, Mar 10, 2011 at 1:54 PM, Colin <colin...@gmail.com> wrote:
> >
> > >>  return super.onKeyDown(keyCode, event);
> >
> > > The "super" method likely executes the default action for the given key
> > > press.
> > > The default action on the back key is to call finish() on the activity.
> >
> > >
> -------------------------------------------------------------------------------------------------
> > > TreKing <http://sites.google.com/site/rezmobileapps/treking> - Chicago
> > > transit tracking app for Android-powered devices
> >
> > >  --
> > > 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
> >
> >
>
> --
> 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
>



-- 
~ Jeremiah:9:23-24
Android 2D MMORPG: http://solrpg.com/ http://www.youtube.com/user/revoltingx

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