Controlling the activity stack

Put your problem here if it does not fit any of the other categories.

Controlling the activity stack

Postby Arreis » Tue Jan 11, 2011 4:25 pm

Hi, everyone. I'm a newbie android developer, still learning the intricacies of the system, and since most of the help I've got since I started were the posts in this forum, I thought this would be a perfect place to get involved. So, nice to meet you all.

Well, here's my question. I'm trying to learn exactly how to control the activity stack, and so I'm trying to make an app that lets me do this:

- There is a menu, common to the whole app, with several items. Each of these items represents a different activity stack, with a root activity and several activities piled on top of it.
- When I create an activity, I want it to go on top of the stack Im currently in.
- When I change from one stack to another through the menu options, I want the top activity in that stack to be shown, and the back button to take me to the previous activity within that same stack.

Let me (try to) illustrate this: After navigating the app for a while, I should have sets of activities similar to these:
· A - A1 - A2 - A3
· B - B1 - B2
· C - C1 - C2 - C3
If C3 is currently in the foreground, pressing back should take me to C2, and selecting A in the menu should take me to A3. Once in A3, pressing back should take me to A2, and so on.

I've been looking at all the docs I've been able to find, but so far I've found no practical way to do this, other than hard-coding onBackPressed() in every activity and keeping a list of created activities. It can't be that difficult, right?
Arreis
Once Poster
Once Poster
 
Posts: 1
Joined: Tue Jan 11, 2011 4:06 pm

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: No registered users and 17 guests