开发者

How to navigate to a certain acticity in a chain without leaking memory

I have a user case like this:

Activity A -> B -> C ->D.

In the Activity D, I want to get开发者_C百科 back to the Activity A. I tried with Intent and it is okay, however, instead of reusing the existing one, it created a new one. Anyone please let me know how to cope it?

Thank a lot!


There is a fine topic on developer.android regarding exactly this question, check it out: avoiding memory leaks


You need to set the flags on the intent when you start A again

Intent i = new Intent(this, ActivityA.class); 
i.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); startActivity(i);

see public Intent setFlags (int flags)

for reference

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜