Resume activity in Android
in order to get back to previous Activity you have to finish the visible one, use this:
finish();
If the activity was started for a result, you should give a result then, like this:
Intent intent = new Intent();
intent.putExtra(KEY_RESPONSE, responseData);
setResult(RESULT_OK, intent);
finish();
And you should catch the result on the caller Activity using:
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
switch (requestCode) {
// Test for the code you have used to start the Activity
}
}
Hope it helps, Regards
If your Activity
is still running, this code will bring it to the front without entering onCreate
Intent openMainActivity = new Intent(TerceraActiviry.this, Main.class);
openMainActivity.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
startActivityIfNeeded(openMainActivity, 0);