简体   繁体   中英

Setting background to all activities on click

I have an app that allows users to change the background. I have an activity in which users get to pick the background that they want from a list of images shown. My only problem is that i don't know how to set the image that they pick as the background for all of the other activities and also how i can save the information so when they get out of the app and come back in to the app, they would still see the image that they set as the background. any help or advice will be appreciated a lot.

Assuming your main problem is how to persist the background image setting and share it across different activities then Shared Preferences may be the best solution. Essentially, it allows you to save simple key value pairs (perhaps the name of the image file in your case?) which is shared across activities and persisted across instances of your application.

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