Ωmega
Ωmega

Reputation: 43703

Change application/window label and icon without change of launcher shortcut

Is it possible to change Android application window title/label and its icon without a change of launcher icon and application name shown on application shortcut?

enter image description here

I mean the icons and window names as shown on the screenshot above. I am not referring to ActionBar (if exist), which is a part of layout.

Is it possible to change this dynamically by code? Is it possible to change it for each activity separately?

Upvotes: 1

Views: 232

Answers (1)

Ben P.
Ben P.

Reputation: 54264

Lollipop added the TaskDescription class: https://developer.android.com/reference/android/app/ActivityManager.TaskDescription.html

In any activity, you can write something like this:

ActivityManager.TaskDescription description = 
        new ActivityManager.TaskDescription("test", null, 0xff0000ff);

setTaskDescription(description);

Some notes:

  • The title you pass will continue to show in the "recents" view, even if you navigate to another activity deeper in the hierarchy
  • Passing null for the icon will leave the default icon in place.
  • The color only applies to the current activity

Upvotes: 2

Related Questions