title: Save the data and using it after restarting the app Android
body: <p>I'm creating a simple app where the user can change the seekbar value. make the default value as 0 and setMax as 5. Every time the app is closed and started back, seekbar value is set to 0. How can I use and set the previous seekbar value which was set before closing the app.</p>
  
  <p>Here's my Activity class ></p>
  
  <pre><code>public class MainActivity extends Activity {
  
  SeekBar s;
  TextView v;
  public int n;
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
  
      s=(SeekBar)findViewById(R.id.seekBar1);
      v=(TextView)findViewById(R.id.textView1);
      next=(Button)findViewById(R.id.button1);
  
      s.setProgress(n);
      v.setText(n+" ");
  
      s.setOnSeekBarChangeListener(new OnSeekBarChangeListener(){
  
          @Override
          public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
              // TODO Auto-generated method stub
              n = progress;
              v.setText(n+" ");
  
          }
  
          @Override
          public void onStartTrackingTouch(SeekBar seekBar) {
              // TODO Auto-generated method stub
  
          }
  
          @Override
          public void onStopTrackingTouch(SeekBar seekBar) {
              // TODO Auto-generated method stub
              v.setText(n+" ");
          }
  
      });
    }
  }
  </code></pre>
  
  <p>I Tried using onSaveInstanceState and onRestoreInstanceState but failed to restore back to the previous state. 
  Please Help</p>
  
  <p>Thanks in Advance.</p>