Android use a different icon for recent apps
Asked Answered
F

2

5

I have a working app but I want to add an alternate version of the app's icon that would be associated with the recent apps window. Instead of the icon that appears on the homescreen, the recent apps window would use the other one.

Facient answered 7/1, 2015 at 22:17 Comment(1)
Rebooting the device fixed the issue for meAmmieammine
F
10

The way this can be done is using the new setTaskDescription(...) method in the Activity class. It can be used to set the title of the task and the icon of the task to display in the recent apps screen. This uses the ActivityManager.TaskDescription class to set these values. See an example below. Note that all this code belongs in the activity whose task description you wish to modify.

Bitmap recentsIcon; // Initialize this to whatever you want
String title;  // You can either set the title to whatever you want or just use null and it will default to your app/activity name
int color; // Set the color you want to set the title to, it's a good idea to use the colorPrimary attribute

ActivityManager.TaskDescription description = ActivityManager.TaskDescription(title, recentsIcon, color);
this.setTaskDescription(description);

Check out the ActivityManager.TaskDescription class documentation as well as this article on using the class.

Fendig answered 23/1, 2015 at 0:2 Comment(0)
P
3

In your Manifest:

android:logo="@mipmap/ic_launcher_round"

I'm not sure why there's a difference between that and icon and roundIcon but this is what worked for me.

Phyl answered 4/12, 2019 at 22:1 Comment(1)
I believe that intended to be android:iconMorra

© 2022 - 2024 — McMap. All rights reserved.