I have an application that acts like a Launcher. This application has 3 actions:
SplashActivity: displays the splash screen at boot time, then starts LauncherActivityand ends. This is an activity marked as a manifest in a manifest.
startActivity(Intent(this, LauncherActivity::class.java))
finish()
<activity
android:name=".SplashActivity"
android:label="@string/app_name"
android:screenOrientation="landscape"
android:theme="@style/SplashTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
<category android:name="android.intent.category.HOME" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
LauncherActivity: The main action for Launcher. Has a menu button that launches DashboardActivity.
startActivity(Intent(this@LauncherActivity, DashboardActivity::class.java))
<activity
android:name=".LauncherActivity"
android:launchMode="singleTask"
android:screenOrientation="landscape" />
DashboardActivity: Displays a list of applications and launches them through their launch.
private val DEFAULT_FLAGS_APP_LAUNCH = Intent.FLAG_ACTIVITY_CLEAR_TOP or Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TASK
startActivity(packageManager.getLaunchIntentForPackage(packageInfo.packageName).apply {
flags = DEFAULT_FLAGS_APP_LAUNCH
})
<activity
android:label="@string/apps"
android:theme="@style/TNA"
android:name=".DashboardActivity"
android:launchMode="singleTask"
android:screenOrientation="landscape" />
All actions are launched through startActivity, including applications.
I want the standard behavior of Android Launcher, that is: when DashboardActivityI enter the application through , if I press the home button, go to the main activity of Launcher ( LauncherActivity), and when you click back, go to the control panel ( DashboardActivity).
, DashboardActivity, LauncherActivity. DashboardActivity, LauncherActivity.
, ?