back-stack

How to clear the Android Stack of activities?

痞子三分冷 提交于 2020-01-26 23:54:11
问题 I have an application with several Activities in Android and I want the user to be able to log-out by pressing a menu button. The problem I have is that A) Android doesn't let you terminate the application and B) even when I send the user to the LoginActivity again they can always press back and get right back to the previous activity they were in. I already tried to launch the Activity with the two following flags: Intent intent = new Intent(this, LoginActivity.class); intent.setFlags(Intent

Recreate the backstack in Android

亡梦爱人 提交于 2020-01-14 07:24:48
问题 I have just implemented a way to change the theme in my app. Pressing a button sets a value in SharedPreferences, then the Activity is recreated, and the theme is changed due to the flag. The problem is how to handle the backstack. Simply recreating the activity is not good because pressing the hardware back button will resume the previous activity (with the old theme still set), whereas if the user did the following: Start in Activity A > B > C > Press theme change button > Press hardware

Stop fragment from being recreated after resume?

家住魔仙堡 提交于 2020-01-11 00:44:09
问题 I am using several fragment s to be dynamically added into activity . Everything works fine, when I press back-button, the fragment s go to backstack . And when I resume it, it appears. But everytime on Resume , it is recreating the fragment and call onCreateView . I know it is a normal behavior of the fragment lifecycle. This is my onCreateView : @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate( R

How to start the activity that is last opened when launch an application?

孤者浪人 提交于 2020-01-06 23:57:34
问题 I designed an app with several activities. There is only an activity instance in the back stack at any time. When I quit the application from an activity named AcitivityOne, how could I launch the application with ActivityOne next time? 回答1: The fast method, is that in your onCreate() put those flags after setContentView() : if ((getIntent().getFlags() & Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT) != 0) { finish(); return; } Also you can create a SharedPreferences with the Activity last oppened as

How to start the activity that is last opened when launch an application?

我的未来我决定 提交于 2020-01-06 23:52:00
问题 I designed an app with several activities. There is only an activity instance in the back stack at any time. When I quit the application from an activity named AcitivityOne, how could I launch the application with ActivityOne next time? 回答1: The fast method, is that in your onCreate() put those flags after setContentView() : if ((getIntent().getFlags() & Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT) != 0) { finish(); return; } Also you can create a SharedPreferences with the Activity last oppened as

Clearing back stack on transition

我怕爱的太早我们不能终老 提交于 2020-01-06 21:15:06
问题 I have a storyboard set up using modal transitions as follows: root -> A -> B -> C When I transition from B to C, I want to clear the backstack because a user will never be able to get back to A, B or root. I know it is not possible to remove the root view controller but is there a way to remove A and B from the stack when transition to C. I have Android background and in there it can be done by simply adding CLEAR_TOP and NEW_TASK flag to the intent before starting next activity. Is there

Clearing back stack on transition

时间秒杀一切 提交于 2020-01-06 21:14:22
问题 I have a storyboard set up using modal transitions as follows: root -> A -> B -> C When I transition from B to C, I want to clear the backstack because a user will never be able to get back to A, B or root. I know it is not possible to remove the root view controller but is there a way to remove A and B from the stack when transition to C. I have Android background and in there it can be done by simply adding CLEAR_TOP and NEW_TASK flag to the intent before starting next activity. Is there

Backstack Tombstone wp7

眉间皱痕 提交于 2020-01-06 19:57:29
问题 I have just finished tombstoning a page in my application when I noticed that I only tombstone the page I am currently viewing, meaning that after I return the pages in the backstack lose all their members and doesn't get tombstoned.. I only find examples on how to tomstone the current page but nothing about tombstoning the backstack pages... What is the elegant way to do this? Just to show How I'm tombstoning: protected override void OnNavigatedTo(NavigationEventArgs e) { if (e

android activity backstack management

余生长醉 提交于 2020-01-06 13:30:03
问题 My app shows some content (video,pdf,img, etc ) and within every content I can start another content. What I want is to have only "one back history". For example, if my activity history is like this: VideoActivityIns1->PdfActivityIns1->VideoActivityIns2 I need to go back from VideoActivityIns2 to PdfActivityIns1, but one step back is should be MainActivity of my app. How can I do this? Any help would be appreciated 回答1: Each activity has activity lifecycle methods you can override to achieve

android activity backstack management

半腔热情 提交于 2020-01-06 13:29:56
问题 My app shows some content (video,pdf,img, etc ) and within every content I can start another content. What I want is to have only "one back history". For example, if my activity history is like this: VideoActivityIns1->PdfActivityIns1->VideoActivityIns2 I need to go back from VideoActivityIns2 to PdfActivityIns1, but one step back is should be MainActivity of my app. How can I do this? Any help would be appreciated 回答1: Each activity has activity lifecycle methods you can override to achieve