Skip to content

Instantly share code, notes, and snippets.

@junf
Last active June 5, 2023 10:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save junf/5074217 to your computer and use it in GitHub Desktop.
Save junf/5074217 to your computer and use it in GitHub Desktop.
Restart Activity with no animation on Android.
private void restartThis() {
finish();
overridePendingTransition(0, 0);
startActivity(getIntent());
overridePendingTransition(0, 0);
}
@Muneesselvaraj171991
Copy link

finish();
overridePendingTransition(0, 0);
startActivity(getIntent());
overridePendingTransition(0, 0);

@kiki-juple
Copy link

private fun restart() { overridePendingTransition(0, 0) recreate() overridePendingTransition(0, 0) }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment