开发者

How to read changes to shared values caused by "sub" activity from main activity?

开发者 https://www.devze.com 2023-04-11 11:58 出处:网络
When the main activity starts the \"sub\" activity and the \"s开发者_开发知识库ub\" activity makes changes to the shared values and is then destroyed (e.g. using the back option on a phone), is there

When the main activity starts the "sub" activity and the "s开发者_开发知识库ub" activity makes changes to the shared values and is then destroyed (e.g. using the back option on a phone), is there a direct way of reading the changes at this stage?

On searching this matter I could only find references to using intent.putExtras and intent.getExtras plus using a bundle object. Are these the only way of handling the information ?

I tried to read the preferences from shared preferences straight after the activity was called thinking that when it finished this would be the next part it would do.


Reading the preferences in you onResume() for your main activity is the statergy I use. It gets them in on startup or after the preferenceActivity has changes, or after any other activity that may of changed them.

0

精彩评论

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

关注公众号