I am a begginer in android. I have a simple code, where I am calling one activity from my 1st activity and in that 2nd activity I have a button on press of which 2nd activity is finished and 1st activity comes up. Is there any way to execute the onSaveInstanceState in the 1st activity. Do I have to edit some thing in the manifest file?
Following is my Code
 public class Activity1 extends Activity {
  /** Called when the activity is first created. */
 TextView mTextView ;
 Button b1;
 static int count=0;
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    mTextView = (TextView) findViewById(R.id.textView2);
    if (savedInstanceState == null) {
        mTextView.setText("Welcome to HelloAndroid!");
    } else {
        mTextView.setText("Welcome Back!");
        System.out.println("count------>"+ count);
    }
    final Intent i = new Intent(this,activity2.class);
    b1 = (Button) findViewById(R.id.button1);
    b1.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            startActivity(i);
            finish();
        }
    });
}
@Override
public void onResume() 
{
    super.onResume();
    System.out.println("inside Resume");
 }
@Override
public void onConfigurationChanged(Configuration newConfig) {
    super.onConfigurationChanged(newConfig);
    // Checks the orientation of the screen
    if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) {
        Toast.makeText(this, "landscape", Toast.LENGTH_SHORT).show();
    } else if (newConfig.orientation == Configuration.ORIENTATION_PORTRAIT){
        Toast.makeText(this, "portrait", Toast.LENGTH_SHORT).show();
    }
}
    @Override
    public void onSaveInstanceState(Bundle savedInstanceState) {
      super.onSaveInstanceState(savedInstanceState);
      savedInstanceState.putBoolean("MyBoolean", true);
      savedInstanceState.putDouble("myDouble", 1.9);
      savedInstanceState.putInt("MyInt", 1);
      savedInstanceState.putString("MyString", "Welcome back to Android");
      count++;
    }
    @Override
    public void onRestoreInstanceState(Bundle savedInstanceState) {
      super.onRestoreInstanceState(savedInstanceState);
      boolean myBoolean = savedInstanceState.getBoolean("MyBoolean");
      double myDouble = savedInstanceState.getDouble("myDouble");
      System.out.println("MyBoolean"+ myBoolean);
      System.out.println("myDouble"+ myDouble);
    }
}
and here is my 2nd activity which is called by the 1st activiy
public class activity2 extends Activity{
TextView textview;
Button b1;
 public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main2);
        textview = (TextView) findViewById(R.id.textView1);
        textview.setText("in activity2");
             final Intent i = new Intent(this,Activity1.class);
        b1 = (Button) findViewById(R.id.button1);
        b1.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                startActivity(i);           
                finish();
            }
        });
 }
}
Some one please help me Thanks!
 
     
     
    