Reputation: 13
I have two EditText
and a Button
in the first activity. After entering the EditText
values and clicking the button, the application navigates to the second activity. When returning back to the first activity, my EditText
values are cleared but I need to display the given values in the EditText
. Can anybody please suggest me a way to do it?
Upvotes: 0
Views: 165
Reputation: 4140
Try this code.
Intent intent = new Intent(this, ActivityNameToLaunch.class);
intent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
startActivity(intent);
Upvotes: 0
Reputation: 56925
Call Activity using startActivityForResult()
instead of startActivity()
and do not finish your first activity.
startActivityForResult(new Intent(YourFirstActivity.this,SecondActivity.class),0);
Edit : As Lucifer suggest store your edittext value in shared prefernce when you call second activity . In first activity onCreate() method after declaring edittext set the sharedPreference value.
Upvotes: 1