[android]为程序创建快捷方式
来源:互联网 发布:淘宝精仿鞋店推荐2016 编辑:程序博客网 时间:2024/06/05 14:42
/**
* 为程序创建桌面快捷方式
*/
private void addShortcut(){
Intent shortcut = new Intent(“com.android.launcher.action.INSTALL_SHORTCUT”);
//快捷方式的名称
shortcut.putExtra(Intent.EXTRA_SHORTCUT_NAME, getString(R.string.app_name));
shortcut.putExtra(“duplicate”, false); //不允许重复创建
//指定当前的Activity为快捷方式启动的对象: 如
//com.everest.video.VideoPlayer
//注意: ComponentName的第二个参数必须加上点号(.),否则快捷方式无法启动相应程序
ComponentName comp = new ComponentName(this.getPackageName(), “.”+this.getLocalClassName());
shortcut.putExtra(Intent.EXTRA_SHORTCUT_INTENT, new Intent(Intent.ACTION_MAIN).setComponent(comp));
//快捷方式的图标
ShortcutIconResource iconRes = Intent.ShortcutIconResource.fromContext(this, R.drawable.icon);
shortcut.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, iconRes);
sendBroadcast(shortcut);
[android]为程序创建快捷方式
VC 为程序创建快捷方式
如何为程序创建快捷方式
为程序创建桌面快捷方式
Android为应用创建快捷方式
Android程序创建桌面快捷方式
Android为应用在桌面创建快捷方式
Android 为应用创建、删除桌面快捷方式
android如何为应用创建快捷方式
Android 为应用程序创建桌面快捷方式
Android 为程序添加桌面快捷方式
Android 为程序添加桌面快捷方式
使用程序创建Android桌面快捷方式
Android学习之程序创建桌面快捷方式
ubuntu为程序创建启动器(如程序快捷方式)
为网站创建快捷方式
为网页创建快捷方式
为app创建快捷方式
PHP用CURL伪造IP和来源
Photoshop中改进ios设计流程的30个诀窍
CSS的行内样式书写规范
NOIP2008普及组参考答案和评分标准(PASCAL语言)
asmlinkage的作用
[android]为程序创建快捷方式
jquery获取对象大全
msdn
获取天气、快递、身份证接口
libgdx的使用--环境搭建测试
dedecms文章内容中加入网站地址
java小技巧临时
Ext4的decode与encode方法的一个小技巧
项目一
* 为程序创建桌面快捷方式
*/
private void addShortcut(){
Intent shortcut = new Intent(“com.android.launcher.action.INSTALL_SHORTCUT”);
//快捷方式的名称
shortcut.putExtra(Intent.EXTRA_SHORTCUT_NAME, getString(R.string.app_name));
shortcut.putExtra(“duplicate”, false); //不允许重复创建
//指定当前的Activity为快捷方式启动的对象: 如
//com.everest.video.VideoPlayer
//注意: ComponentName的第二个参数必须加上点号(.),否则快捷方式无法启动相应程序
ComponentName comp = new ComponentName(this.getPackageName(), “.”+this.getLocalClassName());
shortcut.putExtra(Intent.EXTRA_SHORTCUT_INTENT, new Intent(Intent.ACTION_MAIN).setComponent(comp));
//快捷方式的图标
ShortcutIconResource iconRes = Intent.ShortcutIconResource.fromContext(this, R.drawable.icon);
shortcut.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, iconRes);
sendBroadcast(shortcut);