Android : Android - Set ActionBar color across all Activities?

on Saturday, August 9, 2014


How can I change the color of the ActionBar across all activities? For example, I set the actionbar color in my SettingsActivity, then want to apply that to my MainActivity.


I'm using this code to set the color: actionBar.setBackgroundDrawable(new ColorDrawable(actionBarColor));


I'm also trying to use SharedPreferences to do this, which I haven't found to work so far: prefs.edit().putInt("com.matt.cards.app", actionBarColor); And to get the ActionBarColor: int isActionBar = prefs.getInt("com.matt.cards.app", 0);


I don't really know how SharedPrefs work, so can anyone guide me? Or show me another way to do this?


Thanks


0 comments:

Post a Comment