我在清单文件中配置了启动器活动:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.hzxfkj.jxt" android:versionCode="1" android:versionName="1.1"
android:installLocation="auto"> <!-- auto internalOnly preferExternal -->
<uses-sdk android:minSdkVersion="9" android:targetSdkVersion="9" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.INSTALL_PACKAGES"/>
<uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"></uses-permission>
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<receiver android:name="com.hzxfkj.jxt.BootBroadcastReceiver" >
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<action android:name="android.intent.action.QUICKBOOT_POWERON" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</receiver>
<service android:singleUser="true" android:name="com.hzxfkj.jxt.service.MessageService" android:label="jxtMessages"/>
<activity
android:name="com.hzxfkj.jxt.MainActivity" android:theme="@style/activityTheme" android:alwaysRetainTaskState="true"
android:label="@string/app_name" android:launchMode="singleInstance">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.hzxfkj.jxt.MessageActivity" android:theme="@style/activityTheme"
android:alwaysRetainTaskState="true" android:launchMode="singleInstance"/>
<activity android:name="com.hzxfkj.jxt.LoginActivity" android:theme="@style/activityTheme"
android:alwaysRetainTaskState="true" android:launchMode="singleInstance"/>
<activity android:name="com.hzxfkj.jxt.MsgDetailActivity" android:theme="@style/activityTheme"
android:alwaysRetainTaskState="true" android:launchMode="singleInstance"/>
<activity android:name="com.hzxfkj.android.xflistview.XListViewActivity" android:theme="@style/activityTheme"
android:launchMode="singleInstance"/>
</application>
</manifest>
...
所以当我单击桌面应用程序图标时,MainActivity 将启动。如果我单击 MainActivity 上的按钮,将显示 MessageActivity。然后我点击手机上的“主页”键,该应用程序将被隐藏。但是当我通过单击桌面上的图标重新打开应用程序时,应用程序将显示 MainActivity,而不是最后访问的 MessageActivity。它怎么可能只显示我上次访问的活动页面?