title: How to restore values of a activity when i move to next activity and come back again?
body: <p>I want the values of edit text restored when user comes back to my first activity?
  Please help me out.</p>
  
  <p>Thanks in advance</p>
  
  <p>this is my first activity code for getting user values in edit text</p>
  
  <pre><code>public class IntentActivity extends Activity {
  EditText ed1, ed2;
  float ed1_val, ed2_val;
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      // TODO Auto-generated method stub
      super.onCreate(savedInstanceState);
      setContentView(R.layout.main);
  
      ed1 = (EditText) findViewById(R.id.editText1);
      ed2 = (EditText) findViewById(R.id.editText2);
      Button next = (Button) findViewById(R.id.button1);
  
      next.setOnClickListener(new OnClickListener() {
          public void onClick(View v) {
              Intent intent = new Intent(getApplicationContext(),
                      Second_activity.class);
              startActivity(intent);
          }
      });
  }
  
  /** Called when the activity is first created. */
  @Override
  public void onSaveInstanceState(Bundle savedInstanceState) {
      super.onSaveInstanceState(savedInstanceState);
  
      ed1_val = Float.parseFloat(ed1.getText().toString());
      ed2_val = Float.parseFloat(ed2.getText().toString());
  
      Log.v("TAG", "inside saved instance");
      savedInstanceState.putFloat("ed1", +ed1_val);
      savedInstanceState.putFloat("ed2", +ed2_val);
  }
  
  @Override
  public void onRestoreInstanceState(Bundle savedInstanceState) {
      super.onRestoreInstanceState(savedInstanceState);
  
      Log.v("TAG", "inside on restore");
      float ed_val = savedInstanceState.getFloat("ed1");
      float ed2_val = savedInstanceState.getFloat("ed2");
  
      ed1.setText("" + ed_val);
      ed2.setText("" + ed2_val);
      }
  }
  </code></pre>
  
  <p>this is my second activity code</p>
  
  <pre><code>public class Second_activity extends Activity {
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      // TODO Auto-generated method stub
      super.onCreate(savedInstanceState);
      setContentView(R.layout.second_xml);
  
      Button back = (Button) findViewById(R.id.button1);
      back.setOnClickListener(new OnClickListener() {
          public void onClick(View v) {
              Intent intent = new Intent(getApplicationContext(),
                      IntentActivity.class);
              startActivity(intent);
              }
          });
      }
  }
  </code></pre>