且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

之后,点击一个按钮关闭活动叠加

更新时间:2023-01-13 19:37:10

 意向意图=新的意图(这一点,Home.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(意向);
 

这将杀死之间的所有活动从8日的屏幕,并启动您坎屏幕的背面。还ü可以设置乌拉圭回合主屏幕的acitivty清单中launchmode =singleTop。看到此链接 - developer.android.com/guide/topics/fundamentals.html#acttask

In my app, I start an eight step "wizard" from my landing page in which data is passed from step 1 all the way to step 8. For keeping the data intact while still in between steps, I am not calling finish() on either of the activities. However, when all the steps are complete, is there a way that I can close all the 8 activities I had started and return back to the landing page?

An illustration of sorts here:

Home - Step 1 -> 2 -> 3 -> 4 -> 5 -> 6 -> 7 -> 8

At this point, when the user clicks "Save", close all the Steps (8) and go back to the Home Page. I have been creating a new intent to do this so far, but i realize this is not the best solution. A simple back press takes him back to the 7th Step.

Any help appreciated.

Intent intent = new Intent(this, Home.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);

This will kill all the activities in between from your 8th screen and launch your hom screen back. also u can set ur home screen's acitivty in manifest launchmode="singleTop". see this link - developer.android.com/guide/topics/fundamentals.html#acttask