I need to get previous activity from the stack and update it. Currently when I use startActivity()
on second activity, opens the first one but will create new one, and by clicking back button, opens the first one (the one which not updated). How can I solve this problem?
Activity A
startActivity(new Intent(this, SecondActivity.class));
Activity B
@Override
public void onBackPressed() {
super.onBackPressed();
startActivity(new Intent(this, FirstActivity.class).putExtra("profile", mProfile));
finish();
}