My target is 2.1, can anyone direct me to an example implementation of onBackPressed?
On Mar 10, 8:30 pm, Miguel Morales <therevolti...@gmail.com> wrote: > Well like he said you must be using 2.0+ what's your target sdk set to? > Other than that, you're probably returning false which means your conditions > aren't being met and you're not returning true. You might want to add some > logging or a breakpoint to make sure you even get to that statement. > > > > On Thu, Mar 10, 2011 at 5:27 PM, Colin <colin...@gmail.com> wrote: > > The super return would only be for a key besides down. I believe > > Justin is right with the onBackPressed(), I'm just not sure where or > > how to do that. > > > On Mar 10, 8:10 pm, Miguel Morales <therevolti...@gmail.com> wrote: > > > 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 > > -- > ~ 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