Re-launch current activity using intent

android, android-activity, android-intent, launch

Solution

If your are in an Activity: `this.recreate();`

If your are in a Fragment: `getActivity.recreate();`

Related Links :

How do I restart an Android Activity

how do I restart an activity in android?

Android activity restart

Problem

For an App I am developing, I want to re-launch the current activity using an intent. So I'm in MainActivity.class and I want to re-launch MainActivity.class using the following: ``` Intent intent = new Intent(getApplicationContext(), MainActivity.class); ``` This calls `onDestroy()` but does not re-launch the activity. Why doesn't this work?

Original source

Related problems