Advertisement
Guest User

Untitled

a guest
Aug 4th, 2015
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. public static void putTheme(int color) {
  2. SharedPreferences sharedPref = main_act.getPreferences(Context.MODE_PRIVATE);
  3. SharedPreferences.Editor editor = sharedPref.edit();
  4. editor.putInt("farbe", color);
  5. editor.commit();
  6. debug("Save theme: "+color);
  7. }
  8. public static int getTheme() {
  9. SharedPreferences sharedPref = main_act.getPreferences(Context.MODE_PRIVATE);
  10. int shared_theme = sharedPref.getInt("farbe", 0);
  11. int theme = 0;
  12.  
  13. theme = d_colors[shared_theme];
  14.  
  15. return theme;
  16. }
  17. public static void loadTheme(Activity act) {
  18.  
  19. if (( getTheme() < 0 ) || ( getTheme() > 19) ) {
  20. debug("First start!");
  21. putTheme(5);
  22. return;
  23. }
  24. debug("Theme Number: "+getTheme());
  25. act.setTheme(getTheme());
  26.  
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement