开发者

Android: Single Activity & Multiple Views

开发者 https://www.devze.com 2023-02-08 08:53 出处:网络
I have a very specific situation where i found that a single activity generating multiple views is the most correct approach:

I have a very specific situation where i found that a single activity generating multiple views is the most correct approach:

  • The main activity receives a code from the server (XML like) saying what it should build. That XML can contain links to other views that use similar code.

To use this, i build only one activity that decodes the code sent from the server and builds the view...

When i pass from a screen from this activity to another screen of this activity, retrieving more server-code on press of a button, it's all ok. But... when pressing back, the last view has also been altered.

I understand this, the activity being used is probably the same.. how can开发者_运维百科 i avoid being the same?


You can use a Singleton Class which is initiated only once and retain values.


Found the problem. Really stupid... I had a static variable that was accessed onResume so it messed all up...

0

精彩评论

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