【发布时间】:2018-07-11 11:30:18
【问题描述】:
我有一个简单的应用程序,其中包含两个活动,一个显示动画的启动活动,然后启动一个单顶登陆活动(通过通知处理打开应用程序)并完成。当应用程序从启动器启动时,即使应用程序已经在运行,也会再次调用该启动活动。同样奇怪的是,当我调试应用程序时,这种行为永远不会发生,只有安装了已发布的 apk
飞溅活动
<activity
android:name=".SplashScreen"
android:exported="true"
android:label="@string/app_name"
android:screenOrientation="portrait"
android:stateNotNeeded="true"
android:theme="@android:style/Animation">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
导航到着陆活动并完成
private void navigateToLandingScreen() {
Intent intent = new Intent(SplashScreen.this, LandingActivity.class);
startActivity(intent);
overridePendingTransition(R.anim.splash_fadein, R.anim.splash_fadeout);
finish();
}
单顶启动模式的着陆活动
<activity
android:launchMode="singleTop"
android:name=".LandingActivity"
android:label="@string/app_name"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustPan"/>
【问题讨论】:
标签: android