You can try the following:
MyActivity.finish() Intent intent = new Intent(MyActivity.this, MyActivity.class); startActivity(intent);
Or, if that doesn't work, you can do this:
private boolean isRestarting = false; ... // When button is pressed isRestarting = true; myactivity.finish(); ... // in the onDestroy() method if(isFinishing() && isRestarting){ Intent intent = new Intent(MyActivity.this, MyActivity.class); startActivity(intent); }
source share