不直接添加到桌面中,而是添加到添加快捷方式窗口中

void setshortCut() {

Intent addShortcut
= new Intent();
// 设置快捷方式的名字
addShortcut.putExtra(Intent.EXTRA_SHORTCUT_NAME, "快捷方式练习");
// 构建快捷方式中专门的图标
Parcelable icon = Intent.ShortcutIconResource.fromContext(
ShortcutTest.
this, R.drawable.icon);
// 添加快捷方式图标
addShortcut.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, icon);
// 构建快捷方式执行的Intent
Intent mailto = new Intent(this, ShortcutTest.class);
// 添加快捷方式Intent
addShortcut.putExtra(Intent.EXTRA_SHORTCUT_INTENT, mailto);
// 正常
setResult(RESULT_OK, addShortcut);

}

 2010123014595192.png

Last modification:July 9th, 2011 at 11:24 am
如果觉得我的文章对你有用,请随意赞赏