You was almost there.
Intent.EXTRA_SHORTCUT_ICON
should be a pacelled Bitmap, not a String.
So instead of using:
data.getStringExtra(Intent.EXTRA_SHORTCUT_ICON)
You should be looking at something like:
Bitmap icon = data.getParcelableExtra(Intent.EXTRA_SHORTCUT_ICON);
EDIT:
As a side note, if your dealing with third party applications, EXTRA_SHORTCUT_ICON
could be null, and EXTRA_SHORTCUT_ICON_RESOURCE
may be passed instead.
EXTRA_SHORTCUT_ICON_RESOURCE
is a ShortcutIconResource, which is a class that contains two Strings: packageName
and resourceName
.
(These could be used to load the third party app's resources, then grab the Bitmap resource using the resource name.)