我应该使用的意图传递信息或使用静态变量 [英] Should I pass info using intent or use a static variables
本文介绍了我应该使用的意图传递信息或使用静态变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你的另一个设计问题
如果我有5项活动,可能导致从一个活动
A-> B
A->Ç
A->电子
....等
Another design question for you If I have 5 activities that can result from one activity A->B A->C A->E .... Etc
和活性的有需要传递到所有其他activites值,然后做你recommned并使它们通过故意或者我应该只是有活性的一个全局静态变量和任何其他活动中读取值?
And activity A has values that need to be passed to all other activites, then do you recommned passing them through intent or should I just have a global static variables in activity A and read the values in any other activity?
感谢您
推荐答案
绝对不使用静态公共变量。
Definitely don't use static public variables.
您应该使用:
- 共享preferences或DB数据(缓存)
- 意图演员是否需要在应用程序的某些部分数据(情侣活动)
- 整个应用程序的数据应用继承者,不应该继续存在。
应坚持
这篇关于我应该使用的意图传递信息或使用静态变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文