Which types of flags are used to run an application on Android?
Answers
Activity launch Mode <activity android:launchMode> need to be specified for every android application manifest file.If you don't know about manifest file please go through below explanation "Every application must have an AndroidManifest.xml file (with precisely that name) in its root directory. The manifest file presents essential information about your app to the Android system, information the system must have before it can run any of the app's code." However the launch mode specifies how a new activity should be associated with the current task. There are four types of launch mode *standard *singleTop *singleTask *singleInstance Below is the link for detailed explanation Understand Android Activity's launchMode: standard, singleTop, singleTask and singleInstance Alternatively,you can use flags to modify the default behavior of how an activity will be associated with a task when using startActivity() to start the activity: FLAG_ACTIVITY_NEW_TASK – This starts the activity in a new task. If it’s already running in a task, then that task is brought to the foreground and the activity’s onNewIntent()method receives the intent (this is the same as using singleTask in the manifest) FLAG_ACTIVITY_SINGLE_TOP – In this case, if the activity is currently at the top of the stack, then its onNewIntent() method receives the intent. A new activity is not created (this is the same as using singleTop in the manifest). FLAG_ACTIVITY_CLEAR_TOP – Here, if the activity is already running in the current task, then this activity is brought to the top of the stack (all others above it are destroyed) and its onNewIntent() method will receive the intent. There is no launchMode equivalent for this flag.