Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android use a different icon for recent apps

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.

like image 704
Rand Avatar asked Jan 07 '15 22:01

Rand


People also ask

Can you change the icon of your apps on Android?

Customize App Icons on AndroidScroll down and tap the Look & feel option from the menu. Tap the icon next to Icon style at the top of the list. Under the Adaptive icons section, you can change icons to a different shape, but tap the More button for different shapes.

How do I edit recently used apps on Android?

Tap the Recents key (3 vertical bars at the screen bottom). Swipe up on an app to remove it, or tap “Close All” to remove all apps. In the Recents screen, tap the three dots (menu) > Settings > switch off “Show Recommended Apps”.

How do I change my original app icon?

Press and hold the app icon until a popup appears. Select “Edit”. The following popup window shows you the app icon as well as the application's name (which you can also change here).


1 Answers

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.

like image 66
anthonycr Avatar answered Sep 22 '22 17:09

anthonycr