Reputation: 253
I recently changed the launch activity of my app - by moving the intent-filter (action.MAIN and category.LAUNCHER) in the manifest from the old activity to the new - and since then the new activity name rather than the application name shows in the All Applications list on my test phone (running Android version 2.3.6). In the 'Manage Applications' list it still shows the app name.
It's not a huge deal - because I can always just create a new app with the new launcher activity as default - but it would be nice have the flexibility to change the launcher activity on the fly in the same project. Basically is there something else, other than just cutting and pasting the intent-filter in the manifest, that needs to be done to change the default launcher activity? That is, assuming that's the cause of the problem.
Thanks in advance for any help.
Upvotes: 0
Views: 1218
Reputation: 318
you could see this link
the answer is so great:
android:name=".ui.HomeActivity"
android:label="@string/title_home_activity"
android:icon="@drawable/icon">
<intent-filter android:label="@string/app_`enter code here`name">
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
Upvotes: 0
Reputation: 17304
Just remove the following tag from your new selected Launcher Activity
:
android:label="xyz"
Removing this tag will fix the problem, and yes you can change Launcher Activity
anytime by just copy pasting those tags.
You can also add this tag to your application tag.
Upvotes: 1
Reputation: 4870
From this answer and the Android Documentation:
Use the android:label="@string/activity_sample_code"
on the application element in the Manifest. This will then determine the string displayed to the user as the application name.
Update: The application level label will provide a default for all child-elements. If you override the label on an activity, that label will take precedence. You can again override that activity label with a label on the intent filter! The section in the Android documentation about icons and labels covers that nicely:
In every case, the icon and label set in a containing element become the default icon and label settings for all of the container's subelements.
For simple applications, a label on the application suffices.
TL;DR: For the launcher, the label wins that is found first in this order: LAUNCHER-IntentFilter, Activity with Launcher IntentFilter, Application
Upvotes: 3