I am building an app that requires the user to login to get access to their information. Within the app there are four branches all accessible via menu options. When the user logs in he is placed on the first screen of one of the branches.
I programmed the app so that when the user BACKs to the first screen of any branch, the activity stack is flushed and pressing back again exits the app.
The question: What is the best practice for exiting?
Should pressing back a second time log the user out and return to the login screen.
Or should pressing back log the user out and return the user to the android home screen?
I have seen both ways of doing it and not sure what criteria I should look at to make the proper usability decision.
To clarify the flow:
[Android Home Screen] -> [App Login Screen] -> [Internal App Branch]
I usually capture the Back button, give the user a Toast notification like "Press Back button again to exit". I capture the System.currentTimeMillis and compare subsequent presses for a threshold of 2 seconds or something close to that. I've seen a couple apps do that and it seems pretty intuitive to me.
If the home screen does not require authentication then I would prefer this method. This is a highly subjective question, though. I'm sure there are other people who would disagree with me and say they prefer the log in screen. That's why it's pretty subjective :)
Related
The use of the Home / back button is well documented within the android docs here and here, however it does not state if the expected usage will "save changes" to the state of the current activity.
My specific situation is a user is presented with a data entry form (list of equations) that can be manipulated (and possibly have the data messed up by applying crazy maths) so i want the user to be able to leave "without saving changes".
It is unclear if this is the expected action of the home button, or if it is expected to allow users to return to the activity as they left it.
Clarification would be grand.
My expectation is that the user is prompted when pressing Up, informing the user that her information will be lost. When she confirms, loose the information, when she cancels stay on the Activity.
Edit: Better to only show the prompt when there was any editing done. Otherwise it might be just annoying to the user.
The HOME/BACK buttons are means provided to the user to navigate in an App. The BACK button normally acts as a means to navigate user to the parent of the current screen (Activity) or to the last screen in the chronological order.
HOME button is a quick way to suspend whatever the user is currently doing and come back to it later. So when the user next comes back to the app again, he can start from where he left. Android framework by default will retain the APP or UI state (mostly), so you have to hardly do anything if you want to stick to the default behaviour. But it really depends on the nature of the App. There are apps, which will trim down to the app main screen next time when the user launches (But these are very few).
Also note, that it is really upto the system how long it is going to retain the app's state in the background. Sometimes it gives to memory pressure and user has to start from scratch next time when he launches the app.
hope I answered your question
I'm working on large project, so there is some logic for saving application state, and then opening correct activity(fragment) when it comes from background.
But anyway, I've found that if user navigates through my app and then minimize it - android opens it from background in different ways in following cases:
User taps on app icon (behavior: user see home activity, doesn't matter where he was, when application was minimized)
User select app from android "recent apps" (behavior: user see exactly what he saw, when the application was minimized)
So, what is the difference between launching application from background by this two ways? I always thought, that it is the same mechanism, but, obviously, I was wrong.
Thanks for any answers
You should pay atention on the folowing docs Activity and Tasks. In short words: if user start app from recents you will receive onRestart before onStart (without onCreate it means that your app was just "suspended"). You able to save screen state using onSaveInstanceState(). But in general starting from icon and from recents - different application behaviors and you should provide proper code for this ways.
UPD
As described below root cause of unexpected behaviour was additional lunchmode attribute.
From what I experience as an Android user, both are same.
The difference we usually see is how we close the app
Press back button until app close / finish()
On this state no matter how we open the apps it will go to the main screen
Press Home button
On this state depend on the app. If the app does not handle any Activity the app will same with the first state. But if the app handle something like when onPause() the Activity then finish() the apps, then whatever you open with app icon or recent apps will provide the same result.
Correct me if I am wrong
I would like to know the "idea / use" of the home versus the back button. I mean obviously the home button takes you to the home screen and the back button takes you to the previous screen. What I am trying to understand is what the users / development community expect.
In other words when a user hits home in my application should I handle that event and terminate the application? Is that what the user has grown to expect or just the opposite?
Same for the back button. Do users expect the screen being departed from to be lost much like a web page would be?
What I am getting at is trying to make sure my app behaves consistent with what the user community has grown to expect.
TIA
JB
Home Button will put application in onPause() -> onStop() , again when you relaunch application, the activity will execute the method: onRestart() -> onStart() -> onResume() -> i.e. activity life cycle
and
Back button finishes or kills the current Activity on click of back button and jump back to the previous Activity which is in stack.
Generally I'd say that pressing home is like minimising on a desktop. So I would expect the app to return to where it was.
If it acts like this then I can easily switch between apps if I need to get information from them.
Pressing back should take me backwards through the things I was doing in the app and when I reach the end of the stack it should close.
home button pressing causes an intent that is used by the the launcher app to show itself .
back button is a real event that can be caught within the current app .
in general , home button should hide all apps and go to the launcher , while back button should go back to the previous screen the user saw (finish the activity or dismiss the dialog) , and go to the previous app (task ) in case the current one doesn't have any more screens to show .
The community expects that if you press the home button, your app will go to the background and be resumeable from there. Multitasking is in the core of the Android OS. To finish your activity or app when home button is pressed is unusual to android users.
The back button is when you want to go one step back, like in the browser as you said. If you are know to IOS it will act like when you press the back button there in the top left corner.
Hope this helps
I would like to know the "idea / use" of the home versus the back
button
Let me Discuss for Back Button First.
The back button behavior is inconsistent.
for Users, it is very easy to use.
for Developer, to understand what actually pressing the back button does it isn't so easy.
The back button can perform any of the following actions as Officially said by Android site :
Go back to previous screen (activity)
Dismiss a popup
Terminate a long running process
Close on-screen keyboard
Go to previous page on browser
Exit the running app when on the last activity
Return to previous app when on the last activity and the app was launched through intent from another app
When Problem Occur with BACK button?
An added problem comes when trying to understand when the back button
cancels a running operation and when not. For example, when installing
apps from Android market tapping back takes users to previous screen
and leaves the installation process running in background. I know
there's a rule that back cancels operations that are presented users
as popup progress indicators and any other cases it is used to
navigate. But is that what users expect? Do users have to think before
pressing back to understand what is going to happen?
Home Button
Home button will take users to home screen and swiping in the
multitasking menu will kill the apps if needed. As on ICS on new
phones all the buttons are on-screen the back button could simply get
disabled when user reaches the last activity if the app was launched
from launcher icon. This would make some of the confusion to make away
but still wouldn't solve all the problems.
Finally , Don't Make Users Think Navigation is some what more important. Users should always know where they will endup without thinking.
I don't think there are easy answers for this problem but I think it may help you to find workaround for your problem according to your app.
The droid application I'm currently working on is getting quite large -> many Activities. I'm concerned about the way I should design the navigation in this app.
I have a main menu Activity, which should be the only entry point to the app. If the user start from here, he/she can go quite deep, through many Activities. However, there are Activities that should be accessed by traversing multiple paths, not just 1, from the MainMenu.
By a simple example: let's say the user has a profile, which he/she can view and edit, and can also view other users profile with this Activity. The app also has a forum-like feature. These can normally be accessed from the menu like this:
Menu -> Social Menu -> Forums -> List of posts of a selected forum.
Menu -> About Me -> Profile.
The question: The user's just clicked on the avatar of a forum post's author, so I've displayed that users Profile page. Now, when the user clicks on the Back button, should I take him back to the "Forums", or back to the "About Me" menu?
Since this is a UX issue, the best way to find the best solution is usability testing.
However, If I had to hazard a guess as to what would make the best user experience, I would rely on the principle of least astonishment for scenario. As a user, I expect the back button to take me back. So if I arrive at the "Profile" page from a "Forum" I'd expect to go back to the Forum. If I arrived from a different activity, I'd expect to go back to that activity.
You can always control which activity gets on the stack and which not, such that you control the whole flow of your application. Write down the possibilities, figure out what pressing back would get you back to in what activity and go from there. Try reasoning as a user of your app.
Reading what you wanna do , i'm thinking in a tabHost Layout , and Group Activitys into each layer.
The question I'm about to ask may seem dangerous for the user, so here's the story before the question:
I'm working in a compagny that tries to sell Galaxy Tabs to schools (children under 10). So, I've been asked to develop an application that starts on boot showing a login screen. The child HAS to log in before he's allowed to use the tablet (just like logging in a computer).
My application starts on boot, shows the login screen, all buttons are blocked (the kid must not be able to use the tablet before the application lets him) except the home button.
fortunately, it seems impossible to block the home button.
I've been trying to rebring the application to front when onpause/onstop is called, this kind of hacks.
So my question is : Can I prevent an user to quit my application until I let him do so?
I know this sounds like a virus, I'm not really happy to be looking for this kind of solution either.
You have to build a custom Home screen, and then set it as the default Home application.
EDIT: see more on this previously asked question (at How can I create a custom home-screen replacement application for Android?). You can just make your authorization the default Home application, then when they log in it forwards to the regular Home screen. If they hit the home button your app gets called, can check if they have logged in and if they have will just send them to the regular home screen.