This should be bitwise OR’d or you end up overwriting the earlier flag.
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
Like so:
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
More Related Contents:
- Android: Clear the back stack
- Clear the entire history stack and start a new activity on Android
- Android: Clear Activity Stack
- Android Application Class Lifecycle
- How to return to the latest launched activity when re-launching application after pressing HOME? [duplicate]
- How to run an activity only once like Splash screen
- Activity restart on rotation Android
- How do I create a transparent Activity on Android?
- Communicating between a fragment and an activity – best practices
- How do I disable orientation change on Android?
- Soft keyboard open and close listener in an activity in Android
- How to bring an activity to foreground (top of stack)?
- Error while Running Android Application – Could not initialize OpenglES emulation, use ‘-gpu off’ to disable it
- Android – How to pass HashMap between activities?
- How to make notification intent resume rather than making a new intent?
- startActivity() from BroadcastReceiver
- Finish parent and current activity in Android
- Why does AlertDialog.Builder(Context context) only accepts Activity as a parameter?
- Intent – if activity is running, bring it to front, else start a new one (from notification)
- How do I start an activity from within a Fragment? [duplicate]
- How to create always-top fullscreen overlay activity in Android
- Passing JSONObject into another activity
- android finish() method doesn’t clear app from memory
- Calling startIntentSenderForResult from Fragment (Android Billing v3)
- How to move Bluetooth activity into a Service
- How to prevent the activity from loading twice on pressing the button
- How to close activity and go back to previous activity in android
- Android error “unable to find explicit activity class”
- Android change layout dynamically
- How can I configure Launcher activity programmatically in android?