Emulate back button in multi-view TabActivity

Posted by ZelluX on Stack Overflow See other posts from Stack Overflow or by ZelluX
Published on 2010-06-05T15:40:40Z Indexed on 2010/06/05 15:42 UTC
Read the original article Hit count: 206

Filed under:
|

Hi, all

I have a TabActivity with several tabs. Each tab corresponds to a specific view, and those views may further switch to other views. For example, one of my tabs displays RSS feed list, after user clicks one of the RSS feed, it will switch to a view displaying a list of articles, and after user clicks one of the titles, a full article view will be displayed.

I'm going to add support for "back" button in my application. For instance, in a full article view, after user presses the "back" button, it should switch back to the article list view. And if user presses it the "back" button again, my application should switch back to the feed list view.

My idea is to maintain a Stack<View> during navigation, and every time user presses the "back" button, the program will pop a View out of the stack, and set it as the current view. But I would like to know how to set current view in TabHost. Many thanks.

© Stack Overflow or respective owner

Related posts about android

Related posts about tabhost