简体   繁体   中英

Shared Preferences Between Activities

Still fairly new to android, wondered if anyone can help...

I have an App that has multiple activities. Each Activity has a shared preferences file to save strings for that activity. Each preference has its own name.

However, i want any activity to be able to read all preferences....

Am i right in thinking that if i rename them all to the same preference name, that preference will be accessible from any activity within my App?

Or do i need to create a seperate class to handle all preferences?

Many thanks

Here is a very good tutorial that answers your questions

http://saigeethamn.blogspot.de/2009/10/shared-preferences-android-developer.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM