1

I wanted to start a different activity from my app first, so I moved:

 <intent-filter>
            <action android:name="android.intent.action.MAIN" />

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

This led to an odd (but interesting problem), the name of my app (shown on home screen) has completely changed to the name of the activity that I am calling first. The thing is, I already have the name of the app declared up in the application tag:

 <application
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="This should be the title, right?"
    android:theme="@style/AppTheme" >

But the activity that is starting first is still the name of my app now. I have researched this thoroughly, but the only results were about how to change the name of your app,(example) which is like this:

android:label="This should be the title, right?"

But that's the strange part, as I already have that set, **yet ** the name of the app is still the name of the activity that is launching first. I would love to understand why that is happening, and how to fix this unexpected issue.

Thanks for the expert advice,

Rich

Here is my entire manifest: https://gist.github.com/anonymous/12cd29ad7ea9b2206a2b

Community
  • 1
  • 1
Ruchir Baronia
  • 7,406
  • 5
  • 48
  • 83

2 Answers2

0

The launcher icon will use the label of whatever activity the launcher intent-filter is in. If you want to change the title displayed in the action bar, you can call setTitle() on your Activity at runtime.

RussHWolf
  • 3,555
  • 1
  • 19
  • 26
  • I am not talking about the title of the activity, I am talking about the title of the app, which the user first see's. I don't want to change that title only after the user opens the app, it needs to be one title the whole time. How can I achieve that? – Ruchir Baronia Nov 14 '15 at 00:36
0

The caption used for the launcher icon can be driven by:

  • a label on the <intent-filter>, which you don't have

  • a label on the <activity>

  • a label on the <application>

So, if you have an android:label attribute on the <activity> that now has your MAIN/LAUNCHER <intent-filter>, confirm that it is what you want.

Also, home screen launchers can get a little weird at times, due to caching and such, and so a reboot of the device or emulator may be necessary.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
  • So I should put the `android:label` attribute in my main launcher activity? – Ruchir Baronia Nov 14 '15 at 00:16
  • @Rich: It's an inheritance model. The `` label is used, and if that's not there the `` label is used, and if that's not there the `` label is used. Whether you have `android:label` on your ``, then, depends upon whether you want that activity's icon in the home screen launcher to be different than the `` label. You need the `` label, as that for the whole app and controls things like how you're listed in the Settings app. – CommonsWare Nov 14 '15 at 00:21
  • But I do have the application label, and it still isn't working: – Ruchir Baronia Nov 14 '15 at 00:34
  • @Rich: And have you rebooted the device or emulator, as I mentioned in my answer? – CommonsWare Nov 14 '15 at 00:36
  • Yes I have, but still no luck... :( What should I do? – Ruchir Baronia Nov 14 '15 at 00:38
  • @Rich: I suggest that you edit your question to post your entire manifest as a starting point. – CommonsWare Nov 14 '15 at 00:40
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/95097/discussion-between-rich-and-commonsware). – Ruchir Baronia Nov 14 '15 at 00:42
  • @Rich: Your launcher icon's label should be whatever is in `@string/title_activity_splash_screen`. If it's not on that device, try uninstalling the app entirely and reinstalling it, or installing it on another device, to confirm the problem is with that device and not with the app itself. – CommonsWare Nov 14 '15 at 13:07
  • okay thanks for all your help! I have Marked you best answer and liked your post! – Ruchir Baronia Nov 14 '15 at 17:18