首页 > 移动平台 > 详细

Android创建快捷方式图标

时间:2015-03-03 11:42:01      阅读:285      评论:0      收藏:0      [点我收藏+]

一个方法,在APP需要的时候调用该方法即可:

public void createShortcutIconInHomeScreen() {

		Intent addIntent = new Intent();
		addIntent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, new Intent());
		addIntent.putExtra(Intent.EXTRA_SHORTCUT_NAME, "快捷方式名字");

		// 不重复创建快捷方式图标。
		addIntent.putExtra("duplicate", false);

		// R.drawable.app_logo 快捷方式的图标icon。
		addIntent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE,
				Intent.ShortcutIconResource.fromContext(
						getApplicationContext(), R.drawable.app_logo));
		addIntent.setAction("com.android.launcher.action.INSTALL_SHORTCUT");
		getApplicationContext().sendBroadcast(addIntent);
	}

Android创建快捷方式图标

原文:http://blog.csdn.net/zhangphil/article/details/44035379

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!