title: Saving and restoring state in android
body: <p>I have searched through this and a few other sites for the answer, but I have been unable to find it. I am trying to save a boolean and an int using onSaveInstanceState and onRestoreInstanceState, but I can't seem to get it to work. It doesn't crash or anything, but it either isn't saving it or it isn't restoring it, or I am stupid and have no idea what I am doing. </p>
  
  <hr>
  
  <p>Here is what I have for my activity, do I need to have it in my onCreate somewhere or something?</p>
  
  <pre><code>public class CannonBlast extends Activity {
  /** Called when the activity is first created. */
  private panel panelStuffz;
  
  @Override
  public void onCreate(Bundle savedInstanceState) {
      final Window win = getWindow();
      super.onCreate(savedInstanceState);
      panelStuffz = new panel(this);
      requestWindowFeature(Window.FEATURE_NO_TITLE);
      win.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); 
      setContentView(panelStuffz);
  }
  @Override
  public void onSaveInstanceState(Bundle savedInstanceState){
      savedInstanceState.putInt("HighLevel", panelStuffz.getLevel());
      savedInstanceState.putBoolean("soundstate", panelStuffz.getSound());
      super.onSaveInstanceState(savedInstanceState);
  }
  
  @Override
  public void onRestoreInstanceState(Bundle savedInstanceState) {
      super.onRestoreInstanceState(savedInstanceState);
      panelStuffz.setHighLevel(savedInstanceState.getInt("HighLevel"));
      panelStuffz.setSound(savedInstanceState.getBoolean("soundstate"));
  }
  
  @Override
  public void onResume(){
      super.onResume();
  }
  
  @Override
  public void onPause(){
      super.onPause();
      panelStuffz.setThread(null);
  
  }
  
  @Override
  public void onStop(){
  
  }
  </code></pre>
  
  <p>I tried putting stuff in the onStop, but it crashes, which is why its empty, in case that matters, thanks in advance</p>