开发者

How to get back to root Activity from Java Code ? (Android)

开发者 https://www.devze.com 2023-02-27 03:05 出处:网络
Im creating activities as followi开发者_JAVA技巧ng. A->B->C->D When i click a button in D i need to go back to the home screen (which is A).

Im creating activities as followi开发者_JAVA技巧ng.

A->B->C->D

When i click a button in D i need to go back to the home screen (which is A).

Can anyone suggest me some code to do this.


Do you need to go to android home screen? Then it is a different thing.

But if 'A' is the main activity of your application, then you can call activity 'A' with FLAG_ACTIVITY_CLEAR_TOP. This will clear all activity above 'A' and make top of stack.


Take a look at the Tasks and Back Stack topic in the dev guide.

0

精彩评论

暂无评论...
验证码 换一张
取 消