[android-developers] Re: override back button

2011-03-10 Thread Colin
That is what I understood and was my intention, but it exits in all cases. On Mar 10, 3:16 pm, Dia lorydi3...@gmail.com wrote: Hello, Does your Back Button exit the application in both cases? When animation.state!=1 it should not do anything.  In the other case it should exit. From

[android-developers] Re: override back button

2011-03-10 Thread Colin
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

Re: [android-developers] Re: override back button

2011-03-10 Thread Miguel Morales
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

[android-developers] Re: override back button

2011-03-10 Thread Colin
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

Re: [android-developers] Re: override back button

2011-03-10 Thread Miguel Morales
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

[android-developers] Re: override back button

2011-03-10 Thread Colin
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

Re: [android-developers] Re: override back button

2011-03-10 Thread Miguel Morales
Ah, yeah then seems that onBackPressed needs to be called. I've never used it myself so I can't be of much help there. On Thu, Mar 10, 2011 at 5:44 PM, Colin colin...@gmail.com wrote: My target is 2.1, can anyone direct me to an example implementation of onBackPressed? On Mar 10, 8:30 pm,

Re: [android-developers] Re: override back button

2011-03-10 Thread Justin Anderson
@Override public void onBackPressed() { //Do whatever you need to in here... //To quit call super.onBackPressed() or call finish() } Thanks, Justin Anderson MagouyaWare Developer http://sites.google.com/site/magouyaware On Thu, Mar 10, 2011 at 7:11 PM, Miguel Morales

[android-developers] Re: override back button

2011-03-10 Thread Colin
Thanks. I tried this but my class extending activity but it doesn't have a method to Override. Not sure what I am doing wrong or where this would go. The setup of my project came from this (http:// mobile.dzone.com/articles/beginning-android-game) if anyone can look. On Mar 10, 11:12 pm,

Re: [android-developers] Re: override back button

2011-03-10 Thread Justin Anderson
So you put the onBackPressed() method in the AndroidTutorial class? Thanks, Justin Anderson MagouyaWare Developer http://sites.google.com/site/magouyaware On Thu, Mar 10, 2011 at 9:49 PM, Colin colin...@gmail.com wrote: Thanks. I tried this but my class extending activity but it doesn't

[android-developers] Re: override back button

2011-03-10 Thread Colin
Yep, doesn't know what method to Override. On Mar 10, 11:57 pm, Justin Anderson magouyaw...@gmail.com wrote: So you put the onBackPressed() method in the AndroidTutorial class? Thanks, Justin Anderson MagouyaWare Developerhttp://sites.google.com/site/magouyaware On Thu, Mar 10, 2011 at

Re: [android-developers] Re: override back button

2011-03-10 Thread Dianne Hackborn
The code in my blog post does work: http://android-developers.blogspot.com/2009/12/back-and-other-hard-keys-three-stories.html http://android-developers.blogspot.com/2009/12/back-and-other-hard-keys-three-stories.htmlIf it is not working, I think your problem is elsewhere, not in this code. You