Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void putTheme(int color) {
- SharedPreferences sharedPref = main_act.getPreferences(Context.MODE_PRIVATE);
- SharedPreferences.Editor editor = sharedPref.edit();
- editor.putInt("farbe", color);
- editor.commit();
- debug("Save theme: "+color);
- }
- public static int getTheme() {
- SharedPreferences sharedPref = main_act.getPreferences(Context.MODE_PRIVATE);
- int shared_theme = sharedPref.getInt("farbe", 0);
- int theme = 0;
- theme = d_colors[shared_theme];
- return theme;
- }
- public static void loadTheme(Activity act) {
- if (( getTheme() < 0 ) || ( getTheme() > 19) ) {
- debug("First start!");
- putTheme(5);
- return;
- }
- debug("Theme Number: "+getTheme());
- act.setTheme(getTheme());
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement