There seems to be a mistake in your implementation. The point is that you are trying to use an Intent object to navigate to your MainActivity WebActvitity form. This is problem. You must not do this.
Whenever you want to return to the previous action, you just have to call finish () in the current Activity.
In our scenario, using the Intent in your WebActivity, you create a new instance for your MainActivity that already exists on the stack (background). Just calling finish () in WebActivity should close it, and your MainActivity should be visible.
Make the following changes:
@Override protected void onPostExecute(String result) { super.onPostExecute(result); Log.d("Post result", result); Intent intent = new Intent(getApplicationContext(), MainActivity.class); startActivity(intent); }
Replace the above method as follows:
@Override protected void onPostExecute(String result) { super.onPostExecute(result); Log.d("Post result", result); finish(); }
source share