I want to create own activity as main activity rather than using default MainActivity
.
How can I define that in android manifest?
On latest Android versions - If there are more than one launcher activities and if we don't put this category tag then the activity which is mentioned first in the Android manifest file will get launched as start-up activity.
The "main" activity is the activity that loads first and the rest of your application. Every application can have multiple activities, therefore you can list other activities to load and use later on but you can only have one "main" activity.
In your manifest file , use the below code to declare an activity as a launcher activity:
<activity android:name=".yourActivityName" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity>
From Android Developer docs:
ACTION_MAIN activity: Start up as the initial activity of a task, with no data input and no returned output.
CATEGORY_LAUNCHER: The activity can be the initial activity of a task and is listed in the top-level application launcher`.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With