0

I am making an android app. In the action bar, I have three buttons: the up button, a button that goes to a home page (essentially a restart), and an info button that describes the app.

I have set the info button to go to an activity called 'info activity' that just has some text on it. The issue is this problem: My info activity can be triggered by multiple activities in the app, so this activity does not have one parent I can name in the Android manifest for a return. I cannot find any documentation to allow one activity to return to multiple activities, depending on which the activity the 'info activity' was accessed from and use the up button navigation to return to it. Is this impossible? Or is there another way I can do what I am attempting? It seems like one activity can only have one parent.

1 Answers1

0

The "Up" navigation is designed to work in a hierarchical structure and by that, I guess that means predefined structure. It's not meant to work for dynamic, ad-hoc structures.

From Android designed guide:

The Up button is used to navigate within an app based on the hierarchical relationships between screens. For instance, if screen A displays a list of items, and selecting an item leads to screen B (which presents that item in more detail), then screen B should offer an Up button that returns to screen A.

If a screen is the topmost one in an app (that is, the app's home), it should not present an Up button.

Community
  • 1
  • 1
Szymon
  • 42,577
  • 16
  • 96
  • 114
  • Would you have any other idea for implementing some sort of text display on all activities, with the text being the same? The only thing I can thing of is making multiple activities that display the same info, but that seems redundant and I feel like there's another more effective way. – user3145107 Dec 30 '13 at 05:10
  • Can you use a parent activity for all other activities? – Szymon Dec 30 '13 at 05:16
  • 1
    I just wound up using onBackPressed() – user3145107 Dec 31 '13 at 02:21
  • I have posted an answer here: [link](http://stackoverflow.com/a/27753166/1657573). I hope this works for you. – Michael Tarimo Jan 03 '15 at 08:53