Reputation: 589
I have an app with 3 different activities in it. When I launch the app one of the activities always starts first. But I want a differnt activity to start before the one that is currnetly starting first.
How would I change this to make a differnet activity start first?
Upvotes: 23
Views: 33987
Reputation: 6891
You need to make changes in AndroidManifest.xml file...
<application
android:icon="@drawable/image"
android:label="@string/app_name" >
<activity
android:label="@string/app_name"
android:name="define the activity which you want to start first here" >
<intent-filter >
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".FirstActivity" >
</activity>
<activity android:name=".SecondActivity" >
</activity>
<activity android:name=".ThirdActivity" >
</activity>
</application>
Hope this will help you....
Upvotes: 4
Reputation: 14988
You need to add an intent filter to the activity you want to start on application launch in your app's AndroidManifest.xml
:
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
Upvotes: 5
Reputation: 3059
In your AndroidManifest.xml put the following:
<activity android:label="@string/app_name"
android:name=".TestActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
The intent-filter inside the activity tells Android which Activity to launch.
Upvotes: 0
Reputation: 29632
Open your AnroidManifest.xml file and set the Launching Activity using the intent-filter tag as follows,
<activity android:name=".LaunchingActivity"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
Upvotes: 34