开发者

Use same data in every activity using tab in android

I want to use same data in every activity when I changed tab. I want to set spinner data in 1st tab开发者_如何学Python and get that data when tab changed.

How can is possible?

Thanks.


There was many way like

  1. Store the into the SharedPreference
  2. Make General class and store in that.
  3. Pass the Intent with the bundle of information.

If the data was small then prefer the SharedPreference object which you can get in all the Activity.

If the data are large then create the General class which contain the the static member and assigning that data value to the appropriate object. But avoid the get/set method in android. See more detail about performance

and the last if the data is small and you want to pass through the activity you can set into the Bundle object and set into the Intent.


you can use a sharedpreference with a sharedpreference listener, or some contentobserver, or some custom notification system. There are lots of possibilities

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜