[android-developers] Re: How to warn user when back button is pressed to navigate out of my application?

2010-04-28 Thread westmeadboy
My strategy is to only show a Toast (and maybe Vibration) (warning the user that the next Back will exit the app) if the user has already very recently (<2 secs ago) hit Back to return to the main activity from a secondary activity. This doesn't help the situation of accidentally hitting the back

[android-developers] Re: How to warn user when back button is pressed to navigate out of my application?

2010-04-28 Thread Michael A.
Hi Xiongzh, Do something like the following where appropriate: @Override public boolean onKeyDown(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_BACK) { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setMessage("Quit Y/N?") .setCanc

[android-developers] Re: How to warn user when back button is pressed to navigate out of my application?

2010-04-27 Thread Xiongzh
Yes, you're right! too many side effects if implemented in onStop() thanks On Apr 28, 7:23 am, Dianne Hackborn wrote: > You should catch the back key, and do what behavior you want when it is > pressed. > > Do not do this kind of stuff in onStop().  It is only going to cause you > pain.  For ex

Re: [android-developers] Re: How to warn user when back button is pressed to navigate out of my application?

2010-04-27 Thread Dianne Hackborn
You should catch the back key, and do what behavior you want when it is pressed. Do not do this kind of stuff in onStop(). It is only going to cause you pain. For example, the the user receives a phone call when in your app, the in call activity will be displayed, you will be stopped. When they

[android-developers] Re: How to warn user when back button is pressed to navigate out of my application?

2010-04-27 Thread Mike
I've also had users complain that they accidentally pressed the back button (usually on the Droid) while they were playing a game. Now that I have a Droid, I can see that this would be fairly easy to do since the buttons are on the same pane of glass as the display.I think the issue is with th

[android-developers] Re: How to warn user when back button is pressed to navigate out of my application?

2010-04-27 Thread patbenatar
Streets Of Boston is completely right. You say you have had users complain about hitting back and returning to Home.. These users must be new to Android and have not come to understand how their new mobile system functions. Think about how many users actually desire the native behavior from your a

[android-developers] Re: How to warn user when back button is pressed to navigate out of my application?

2010-04-27 Thread Streets Of Boston
I would strongly advise against fighting the normal stack-based work- flow of android activities. If the user pressed the back-key, he/she probably wants to 'go back'. Don't fight your customer on this. Don't try to break or modify the work-flow model of Android. But, if you must, you could warn t

[android-developers] Re: How to warn user when back button is pressed to navigate out of my application?

2010-04-27 Thread Zigurd
Maybe an audible cue that they are about to navigate back out? But, as others have said, that navigation should have no bad consequences, so the user need not be aware of it. While a "home" navigation in the option menu is not desirable, that would be one way to enable your users to return to the

[android-developers] Re: How to warn user when back button is pressed to navigate out of my application?

2010-04-27 Thread Xiongzh
But it's totally transparent to the customer, isn't it? The activity should be in the very top of the Android stacks. So it would be bring up again quickly. On Apr 27, 3:28 pm, patbenatar wrote: > > Restarting the Activity in onStop sounds incredibly intrusive for your > user experience. > > -Nic

[android-developers] Re: How to warn user when back button is pressed to navigate out of my application?

2010-04-27 Thread Xiongzh
Yes, I have keep in back stack what should in the back stack. But sometimes customers just want to navigate to the activity in the bottom of the stack, i.e, the first view the see, the main view I assume. They are not intent to leave my application. That's why they ask for a confirmation when they

[android-developers] Re: How to warn user when back button is pressed to navigate out of my application?

2010-04-27 Thread patbenatar
Wait I'm a bit confused... If the user wants to hit the back button to go back to the previous Activity, I'm assuming you're talking about a previous Activity within your app? This functionality is native to Android and should be maintained throughout your app. If you start an activity for result a

[android-developers] Re: How to warn user when back button is pressed to navigate out of my application?

2010-04-27 Thread patbenatar
You can override onBackPressed in your Activity. This is called when the user presses the back button, before your Activity is finished by the system. You could pop a dialog asking the user to confirm this action, if they hit yes you call through to the super and the Activity gets finished, if they

[android-developers] Re: How to warn user when back button is pressed to navigate out of my application?

2010-04-27 Thread Xiongzh
Some of my customers are accustomed to use the back button to go back to the previous activity. Some complained that they often navigate out of the application by pressing back button. I think it would be nice to customers if they can be warned. Thanks for your suggestion. How do think the approa

[android-developers] Re: How to warn user when back button is pressed to navigate out of my application?

2010-04-26 Thread Nicholas Albion
My first thought was to suggest that you rethink if you really need to do this - maybe your app isn't going to be as important to your users as you may think. But then, I been frustrated in the past by games which exit in the middle of the game if you press too far right... Maybe you should provi