Which types of flags are used to run an application on Android?

0 votes
59 views
Kalin asked 14-Apr-2022 in troubleshooting by Kalin

Which types of flags are used to run an application on Android?

1 Answer

0 votes
Hitesh Vohra answered 16-Apr-2022 by Hitesh Vohra
Which types of flags are used to run an application on Android?
  • There are two types of flags that can be used to execute an application in Android:
  • FLAG ACTIVITY NEW TASK
  • FLAG ACTIVITY CLEAR TOP
  • On Android, activities are launched using intents. You can control the task that will contain the activity by setting flags. There are flags for creating new activities, using existing activities, and bringing an existing instance of an activity to the front. 
  • FLAG ACTIVITY NEW TASK is one of the flags that can be used to change the default behaviour. In a new task, begin the action. If a task for the activity you're initiating is already running, it's brought to the foreground with its previous state restored, and the activity gets the new intent in onNewIntent().
  • FLAG ACTIVITY CLEAR TOP: If the Activity being started is already running in the current task, all other activities on top of it are terminated (with a call to the onDestroy function) and this intent is provided to the restarted instance of the Activity.


Read More: How to terminate a running process in Linux?