Skip to content Skip to sidebar Skip to footer

Set Different Icon/image For Shortcut ?

I have written a program that can create shortcut of my application in android emulator homescreen.But the problem is when i created the shortcut then it has the default android ic

Solution 1:

The system is not in your context. You therefore need to give more details to send you icon.

see https://github.com/ldo/ShortcutCircus_Android/blob/master/src/Activity2.java

The icon is given by :

Intent.ShortcutIconResource.fromContext(Activity2.this, R.drawable.icon)

Or you could decode the bitmap and use EXTRA_SHORTCUT_ICON instead.

Solution 2:

You can do this in two way.

putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE,resId);

putExtra(Intent.EXTRA_SHORTCUT_ICON, bitmap);

Post a Comment for "Set Different Icon/image For Shortcut ?"