Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Always launch the main activity

Tags:

android

My application has 4 activities. If the user clicks the home button, the next time the application is launched, I want it to start on the main activity not the last activity it was on. If the phone's display turns off, as long as the application hasn't been closed, I want it to resume where it left off. What is the proper way to go about this?

like image 707
Roger Avatar asked Apr 04 '11 14:04

Roger


People also ask

What is a launch activity?

This is the default launch mode of activity (If not specified). It launches a new instance of an activity in the task from which it was launched. Numerous instances of the activity can be generated, and multiple instances of the activity can be assigned to the same or separate tasks.

What is main activity?

Typically, one activity in an app is specified as the main activity, which is the first screen to appear when the user launches the app. Each activity can then start another activity in order to perform different actions.

What is the default launch mode of an activity?

There are four types of launch modes in Android: Standard. SingleTop. SingleTask.


1 Answers

Just set clearTaskOnLaunch="true" in your manifest main activity declaration.

http://developer.android.com/guide/topics/manifest/activity-element.html#clear

like image 190
tbruyelle Avatar answered Oct 27 '22 00:10

tbruyelle