The motivation is to theme my desktop in an un-intrusive way,
basically to create shortcuts on the desktop to 3rdParty apps with a
different icon. The following code works, on the ASUS eeePad for the
Browser, Gmail, and File Manager but not for other apps like Gallery.
The error is "Application is not installed", which seems to be some
generic android error which gives no real information for why the
action is not working.
Thanks for any help.
PS: why doesn't this Google Groups interface have a way to tag code
segments?
Intent shortcutIntent = getAppLauncherIntent("com.google.android.gm");
String shortcutName = "Email";
AddShortcut(shortcutName, shortcutIntent, this);
private Intent getAppLauncherIntent(String packageName)
{
Intent intent = new Intent(Intent.ACTION_MAIN);
intent.addCategory(Intent.CATEGORY_LAUNCHER);
intent.setPackage(packageName);
return intent;
}
private void AddShortcut(String name, Intent intent, Context context)
{
Intent addIntent = new Intent();
addIntent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, intent);
addIntent.putExtra(Intent.EXTRA_SHORTCUT_NAME, name);
addIntent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE,
Intent.ShortcutIconResource.fromContext(context,
R.drawable.typewriter));
addIntent.setAction("com.android.launcher.action.INSTALL_SHORTCUT");
context.sendBroadcast(addIntent);
}
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en