title: On Button click change the theme of whole application dynamically and store it
body: <p>I am using Utills class for the theme changing on click of button, there are 8 buttons with image background. Here is my Utills class</p>
  
  <pre><code>public class Utills {
  
  public static boolean isPurchsed =true;
  private static int sTheme;
  public final static int THEME_DEFAULT = 0;
  public final static int THEME_ONE = 1;
  public final static int THEME_TWO = 2;
  public final static int THEME_THREE = 3;
  public final static int THEME_FOUR = 4;
  public final static int THEME_FIVE = 5;
  public final static int THEME_SIX = 6;
  public final static int THEME_SEVEN = 7;
  /**
   * Set the theme of the Activity, and restart it by creating a new Activity of the same type.
   */
  public static void changeToTheme(Activity activity, int theme)
  {
      sTheme = theme;
      activity.finish();
      activity.startActivity(new Intent(activity, activity.getClass()));
  }
  /** Set the theme of the activity, according to the configuration. */
  public static void onActivityCreateSetTheme(Activity activity)
  {
      switch (sTheme)
      {
          default:
          case THEME_DEFAULT:
              activity.setTheme(R.style.MyTheme);
              break;
          case THEME_ONE:
              activity.setTheme(R.style.MySecondTheme);
              break;
          case THEME_TWO:
              activity.setTheme(R.style.MyThirdTheme);
              break;
          case THEME_THREE:
              activity.setTheme(R.style.MyFourthTheme);
              break;
          case THEME_FOUR:
              activity.setTheme(R.style.MyFifthTheme);
              break;
          case THEME_FIVE:
              activity.setTheme(R.style.MySixthTheme);
              break;
          case THEME_SIX:
              activity.setTheme(R.style.MySeventhTheme);
              break;
          case THEME_SEVEN:
              activity.setTheme(R.style.MyLastTheme);
              break;
      }
  }
  </code></pre>
  
  <p>And here is activity class</p>
  
  <pre><code>public class ChangeBackgroundActivity extends AppCompatActivity {
  
  
  Button bck1, bck2, bck3, bck4, bck5, bck6,bck7,bck8;
  
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
  
      Utills.onActivityCreateSetTheme(this);
      setContentView(R.layout.activity_change_background);
      Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar_changebackground);
      setSupportActionBar(toolbar);
  
  
      bck1 = (Button)findViewById(R.id.btn_bck1);
      bck1.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View v) {
              Utills.changeToTheme(ChangeBackgroundActivity.this, Utills.THEME_DEFAULT);
          }
      });
  
      bck2 = (Button)findViewById(R.id.btn_bck2);
      bck2.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View v) {
              Utills.changeToTheme(ChangeBackgroundActivity.this, Utills.THEME_ONE);
          }
      });
  
  
      bck3 = (Button)findViewById(R.id.btn_bck3);
      bck3.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View v) {
              Utills.changeToTheme(ChangeBackgroundActivity.this, Utills.THEME_TWO);
          }
      });
  
      bck4 = (Button)findViewById(R.id.btn_bck4);
      bck4.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View v) {
              Utills.changeToTheme(ChangeBackgroundActivity.this, Utills.THEME_THREE);
          }
      });
      bck5 = (Button)findViewById(R.id.btn_bck5);
      bck5.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View v) {
              Utills.changeToTheme(ChangeBackgroundActivity.this, Utills.THEME_FOUR);
          }
      });
      bck6 = (Button)findViewById(R.id.btn_bck6);
      bck6.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View v) {
              Utills.changeToTheme(ChangeBackgroundActivity.this, Utills.THEME_FIVE);
          }
      });
      bck7 = (Button)findViewById(R.id.btn_bck7);
      bck7.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View v) {
              Utills.changeToTheme(ChangeBackgroundActivity.this, Utills.THEME_SIX);
          }
      });
      bck8 = (Button)findViewById(R.id.btn_bck8);
      bck8.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View v) {
              Utills.changeToTheme(ChangeBackgroundActivity.this,Utills.THEME_SEVEN);
          }
      });
  
  }
  </code></pre>
  
  <p>When I close my application and restart it the default theme again set on whole application. 
  How to store the theme for application from Utills class, so whenever I close my application and restart it again the selected theme will set for whole application.</p>