gpt4 book ai didi

java - 为什么 MAIN 和 LAUNCHER Activity 不是首先开始?

转载 作者:搜寻专家 更新时间:2023-11-01 08:56:50 25 4
gpt4 key购买 nike

我有 2 个 Activity ,“Splash”和“StartingPoint”。我的 XML 明确指出“Splash”是带有 MAIN 和 LAUNCHER 的 Activity,但是在运行应用程序时,“StartingPoint”似乎总是第一个运行的东西。我该如何解决?

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.commer.commest"
android:versionCode="1"
android:versionName="1.0" >

<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="18" />

<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >

<activity android:name="com.commer.commest.Splash"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.commer.commest.StartingPoint"
android:label="@string/app_name">
<intent-filter>
<action android:name="com.commer.commest.STARTINGPOINT" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
</application>

</manifest>

最佳答案

遇到了类似的问题,
在我的例子中,罪魁祸首是

android:launchMode="singleInstance"

我必须从 Splash 中删除它才能每次启动它。

    <activity
android:name=".features.splash.SplashActivity"
android:launchMode="singleInstance" // had to remove this
android:screenOrientation="portrait"
android:theme="@style/SplashTheme"
android:windowSoftInputMode="stateHidden">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>

<activity
android:name=".features.login.LoginActivity"
android:screenOrientation="portrait"
android:windowSoftInputMode="stateHidden" />

关于java - 为什么 MAIN 和 LAUNCHER Activity 不是首先开始?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18415033/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com