Skip to content Skip to sidebar Skip to footer

Dynamically Change Values Of Colors.xml To Change Look And Feel Of Android App

Problem : I am trying to change the look and feel of my Android app, on the fly. Something like, the app starts up and gets a set of values from the server. These values are the el

Solution 1:

You can achive this change by newly introduce firebase remote config which provide remote config to change theme color or any other values necessary for app like promotion,updates etc

You can refer this Example

Solution 2:

Unfortunately all color values (and other resources) inside the resources directory are hardcoded as static final ints. This means there is no way to change the values at runtime. You can however use one of the previously suggested solutions or have a look at this excellent explanation: https://stackoverflow.com/a/33992017/3662251

For a nice workaround that overrides the activity's getResources method and implements a custom Resources class which is in my opinion the most seamless solution: https://stackoverflow.com/a/34178187/3662251

Solution 3:

I have did that in my app getting Hex color code like #06FF67 from my server and stored in sharedpreferences - https://stackoverflow.com/a/23024962/4741746

And when need to set new value that coming from server just override same shared preferences value with new data and set to app

Or you can use Random Color genrater also -https://stackoverflow.com/a/5280929/4741746

Post a Comment for "Dynamically Change Values Of Colors.xml To Change Look And Feel Of Android App"