Android uses a different icon for recent applications

I have a working application, but I want to add an alternative version of the application icon, which will be associated with the window of recent applications. Instead of the icon displayed on the main screen, the last application window will use a different one.

+4
source share
1 answer

How to do this, use the new method setTaskDescription(...)in the Activity class. It can be used to set the task name and task icon to display the latest applications on the screen. A class is used to set these values ActivityManager.TaskDescription. See the example below. Please note that all this code belongs to an activity whose task description you want to change.

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 a good idea to use the colorPrimary attribute

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

Check out the documentation for the ActivityManager.TaskDescription class , as well as this article about using the class.

+8
source

Source: https://habr.com/ru/post/1570367/


All Articles