:::: MENU ::::

How to restart an Activity on Android (Java)

Using the function bellow in a activity class you can restart the current activity.

private void restartActivity() {
   Intent intent = getIntent();

Why did you need to restart an activity? Well personally I need it after I had change the current Locale – in order to change the app language. Changing the locale to another language and forcing the activity to restart it olso force it to load the layout and string values from the new language folder, in this way I did implement a language changing option.

Comments are closed.