开发者

Android: Infinite Sub-Activity. Will it be a memory issue?

开发者 https://www.devze.com 2023-01-13 09:25 出处:网络
I have 2 Activities - A and B In Activity A containing a list view spawns a new Sub-Activity B. In Acitivty B there is a button that launches Activity A so as开发者_运维技巧 to select another Sub-Act

I have 2 Activities - A and B

In Activity A containing a list view spawns a new Sub-Activity B. In Acitivty B there is a button that launches Activity A so as开发者_运维技巧 to select another Sub-Activity B.

This seem to create an infinite loop scenario where

A->B->A->B->A->B->A->B->..............

So if i quit the program halfway, and the go back again will i get an issue?

because my programs has a exception thrown randomly that i have no solution to.


Without seeing the stack trace we really can't help you. This sounds like it's a really bad design patter though. You should take a look at the different launch modes

http://developer.android.com/guide/topics/fundamentals.html#lmodes


What kind of exception does your program throw?

And no - this shouldn't be an issue as Android removes unused Activities from memory. The issue would happen if you would hold unused Activities in some variable fields and Android couldn't dispose them.

0

精彩评论

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