0

这是我的 android 清单,由于某种原因,我的 MainActivity 没有首先启动。每当我运行应用程序时首先启动的活动是 RegisterActivity。谁能帮我弄清楚为什么?

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

    <uses-sdk
        android:minSdkVersion="10"
        android:targetSdkVersion="17" />

    <uses-permission android:name="android.permission.INTERNET" />

    <permission
        android:name="com.indigohate.permission.C2D_MESSAGE"
        android:protectionLevel="signature" />

    <uses-permission android:name="com.indigohate.permission.C2D_MESSAGE" />
    <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
    <uses-permission android:name="android.permission.WAKE_LOCK" />
    <uses-permission android:name="android.permission.GET_ACCOUNTS" />
    <uses-permission android:name="android.permission.USE_CREDENTIALS" />

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


        <service android:name="com.indigohate.GCMIntentService" />

        <receiver
            android:name="com.google.android.gcm.GCMBroadcastReceiver"
            android:permission="com.google.android.c2dm.permission.SEND" >
            <intent-filter>
                <action android:name="com.google.android.c2dm.intent.RECEIVE" />

                <category android:name="com.indigohate" />
            </intent-filter>
            <intent-filter>
                <action android:name="com.google.android.c2dm.intent.REGISTRATION" />

                <category android:name="com.indigohate" />
            </intent-filter>
        </receiver>

        <activity
            android:name="com.indigohate.MainActivity"
            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.indigohate.RegisterActivity"
            android:launchMode="singleTop" />
        <activity
            android:name="com.indigohate.UserRegister"
            android:launchMode="singleTop" />
        <activity
            android:name="com.indigohate.LoginActivity"
            android:launchMode="singleTop" >

        </activity>
        <activity
            android:name="com.indigohate.RideRequest"
            android:label="@string/title_activity_ride_request" >
        </activity>
        <activity
            android:name="com.indigohate.TimePickerFragment"
            android:label="@string/title_activity_time_picker_fragment" >
        </activity>
        <activity
            android:name="com.indigohate.SearchResultsListActivity"
            android:launchMode="singleTop" />
        <activity
            android:name="com.indigohate.LoadingScreenActivity"
            android:label="@string/title_activity_loading_screen" >
        </activity>
        <activity
            android:name="com.indigohate.HomeActivity"
            android:label="@string/title_activity_home" >
        </activity>
        <activity
            android:name="com.indigohate.LostPasswordActivity"
            android:label="@string/title_activity_lost_password" >
        </activity>
        <activity
            android:name="com.indigohate.RideOfferActivity"
            android:label="@string/title_activity_ride_offer" >
        </activity>
        <activity
            android:name="com.indigohate.StartRideActivity"
            android:label="@string/title_activity_start_ride" >
        </activity>
        <activity
            android:name="com.indigohate.StopRideActivity"
            android:label="@string/title_activity_stop_ride" >
        </activity>
        <activity
            android:name="com.indigohate.CalendarActivity"
            android:label="@string/title_activity_calendar" >
        </activity>
        <activity
            android:name="com.indigohate.ProfileActivity"
            android:label="@string/title_activity_profile" >
        </activity>
        <activity
            android:name="com.indigohate.MakeCommentActivity"
            android:label="@string/title_activity_make_comment" >
        </activity>
        <activity
            android:name="com.indigohate.PaymentInformationActivity"
            android:label="@string/title_activity_payment_information" >
        </activity>
        <activity
            android:name="com.indigohate.RideHistoryActivity"
            android:label="@string/title_activity_ride_history" >
        </activity>
    </application>

</manifest>
4

1 回答 1

3

这是因为你在你的RegisterActivity

android:launchMode="singleTop"

在所有活动中删除所有这些启动模式。仅将其保留在您的 MainActivity 中:

<activity
            android:name="com.indigohate.MainActivity"
            android:label="@string/app_name"
            android:launchMode="singleTop" 
 >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

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

启动活动包含<category android:name="android.intent.category.LAUNCHER" />以确保它launcher是应用程序启动时的活动。

于 2013-05-20T03:29:08.500 回答