voidsetshortCut() {
Intent addShortcut=newIntent();
//设置快捷方式的名字
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=newIntent(this, ShortcutTest.class);
//添加快捷方式Intent
addShortcut.putExtra(Intent.EXTRA_SHORTCUT_INTENT, mailto);
//正常
setResult(RESULT_OK, addShortcut);
}
Last modification:July 9, 2011
© Allow specification reprint