Google I/O 2012 - Navigation in Android

Google for Developers · 48K views · 2012 · 1:01:53

Open on YouTube

Software architecture & designUX & UI designSoftware (other)talkdated

Why Stack Overflow recommends it

Stack Overflow users link it when answering questions about the activity back stack, Back versus Up behavior, and intent flags, since it explains how Android tasks and navigation are meant to work.

Recommended by 3 people across 3 different months, 2012 to 2013.

What it is

A Google I/O 2012 session by Android engineers Adam Powell and Richard Fulcher on how navigation works in Android 3.0 and 4.0. It covers Up navigation with the Action Bar, consistent Back key behavior within tasks, the revamped Recent Tasks UI, and how to design navigation that works across Android versions.

What people said

Strong rec codeMagic · 2013-05 · Stack Overflow · on “Send Bundle to calling activity”

The best way to do this would be to start Prompt with startActivityForResult() then return the values to onActivityResult() Docs [LINK] with example If for some reason this won't work for you then you can probably find an Intent flag that will accomplish what you need depending on your situation. One that may work for you is FLAG_ACTIVITY_REORDER_TO_FRONT [LINK] This will bring your MainActivity to the top of the stack Also, as long as you call finish() on your PromptActivity after calling startActivity then it will be cleared from the stack You should watch Google I/O Navigation [this video] . It explains navigation and how the stack works very well

Recommends Alex Lockwood · 2012-07 · Stack Overflow · on “Navigation Drawer (Google+ vs. YouTube)”

Edit #3: The Navigation Drawer pattern is officially described in the Android documentation! Check out the following links: Design docs can be found here [LINK] . Developer docs can be found here [LINK] . Edit #2: Roman Nurik (an Android design engineer at Google) has confirmed that the recommended behavior is to not move the Action Bar when opening the drawer (like the YouTube app). See this Google+ post [LINK] . Edit #1: I answered this question a while ago, but I'm back to re-emphasize that Prixing has the best fly-out menu out there... by far . It's absolutely beautiful, perfectly smooth, and it puts Facebook, Google+, and YouTube to shame. EverNote is pretty good too... but still not as

Recommends Tobias Ritzau · 2012-09 · Stack Overflow · on “Android, managing views, task and activities”

I'll start of with what you should watch and read. It should be clear that navigation in Android is very easy to do wrong. Google has a history of doing differently from app to app, but they are getting better. This said, if you are to do an app you should know how it is intended to work, and the best way to do that is to read the docs. As mentioned, there was an excellent talk at IO'12 [this video] . There is also a very good section on the design site [LINK] , and finally there is a good section in the API Guides [LINK] . To summarize: a full screen is an activity (which in turn can be constructed of fragments). The activities should in virtually all cases be structured as a tree with the root

Recommends codeMagic · 2013-05 · Stack Overflow · on “startActivity creates a new Activity instead of bring to front (flag set)”

You have your Flag set on notificationIntent instead of Intent for ActivityB . Change this Intent i = new Intent(getActivity(), B.class); getActivity().startActivity(i); to Intent i = new Intent(getActivity(), B.class); i.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT) getActivity().startActivity(i); Google I/O Navigation [this video] this link is very helpful in understanding how the stack works

Cites Jeff Axelrod · 2012-09 · Stack Overflow · on “How to create tabbed layout in Android 4.0?”

`TabWidget` [LINK] is not deprecated, `TabActivity` [LINK] is. The action bar is not necessarily preferred [LINK] , it depends upon the use, as answered by Adam Powell Android platform navigation expert [this video] .

Cites codeMagic · 2013-07 · Stack Overflow · on “Removing an Activity from History Stack”

I'm not sure if I completely understand this if I have back to D and press Back Button I will return to C not E but if I do all you have to do is call finish() when you are done in E then you will return to D, then to C when you press back in D. If this is not what you are talking about then please clarify your question. But, when you finish() and Activity then it is cleared off of the stack so you would never return to E until you start it again. You never would from D anyway by pressing the back button Google I/O Navigation [this video] In its most basic form, Activities are put on the stack on top of each other in the way they come in. If you leave one, by calling finish() or pressing back, th

Cites codeMagic · 2013-08 · Stack Overflow · on “Will my application benefit from launch modes and intent flags?”

From what I understand of your problem, you can use the Intent Flag FLAG_ACTIVITY_REORDER_TO_FRONT . If the Activity is already on the stack then it will, as it says, bring it to the top of the stack so you don't have multiple instances of it. Something like Intent i = new Intent(MainActivity.this, KeypadActivity.class); i.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); startActivity(i); You can find all available Flags Here in the Docs [LINK] Also, calling finish() on say the keypad Activity when you are done with it and go to the next one will take it off of the stack. Google navigation presentation [this video]