I have an ActivityA
, which starts ActivityB
through Intent's startActivity()
method.The context is as below:
A.java
String name = edittext.getString();
Intent i = new Intent(A.this,B.class);
Bundle b = new Bundle();
b.putString("Name",name);
i.putExtras(b);
startActivity(b);
B.java
Bundle bb=getIntent().getExtras();
String namee=bb.getString("name");
In this B Activity there will be Back button which when clicked takes control back to A as below:
back.setOnClickListener(new OnClickListener()
{
public void onClick(View arg0) {
Intent backToDetails = new Intent(B.this,A.class);
startActivity(backToDetails);
}
});
Now control comes to ActivityA
. When I again start Activity B
from Activity A
, the previous value of the name is lost .So, I again get new Value by overwrting old value in Activity B
. So, how to save previous name value ?
How to save the state of Activity B?
Can any one help me in sorting out this issue?
Thanks In Advance,