最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

Android中創(chuàng)建快捷方式及刪除快捷方式實現方法

 更新時間:2015年06月09日 11:21:26   投稿:junjie  
這篇文章主要介紹了Android中創(chuàng)建快捷方式及刪除快捷方式實現方法,本文直接給出實現代碼,需要的朋友可以參考下
/**
	 * 
	 * 創(chuàng)建快捷方式
	 * @param map 快捷方式圖標
	 * @param appName 快捷方式標題
	 * @param appUrl 快捷方式打開的地址
	 * @param iconUrl 快捷方式圖標地址
	 * 
	 * */
	public static void createShortcut(Context activity ,Bitmap map ,String appName ,String appUrl ,String iconUrl){
		Intent shortcut = new Intent(
				"com.android.launcher.action.INSTALL_SHORTCUT");
		shortcut.putExtra(Intent.EXTRA_SHORTCUT_NAME,appName);
		shortcut.putExtra("duplicate", false);// 設置是否重復創(chuàng)建
		Intent intent = new Intent();
		intent.setAction(Intent.ACTION_VIEW) ;
//		intent.addCategory(Intent.CATEGORY_LAUNCHER);
		intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) ;
		intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK) ;
		intent.setClass(activity, WebViewActivity.class);// 設置第一個頁面
		intent.putExtra("keyword", appUrl);
		intent.putExtra("appName", appName) ;
		intent.putExtra("iconUrl", iconUrl) ;
		shortcut.putExtra(Intent.EXTRA_SHORTCUT_INTENT, intent);
		shortcut.putExtra(Intent.EXTRA_SHORTCUT_ICON, map);
		activity.sendBroadcast(shortcut);		
	}
	/**
	 * 
	 * 刪除快捷方式
	 * @param shortcutName app名字
	 * @param className 絕對路徑如:getPackageName() + ".WebViewActivity"
	 * 
	 * */
	public static void removeShortcut(Context cxt, String shortcutName, String className) {
    Intent shortcutIntent = new Intent(Intent.ACTION_VIEW);
    shortcutIntent.setClassName(cxt, className);
    Intent intent = new Intent("com.android.launcher.action.UNINSTALL_SHORTCUT");
    intent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, shortcutIntent);
    intent.putExtra(Intent.EXTRA_SHORTCUT_NAME, shortcutName);
    cxt.sendBroadcast(intent);
  }

相關文章

最新評論

霸州市| 扎兰屯市| 图们市| 诸暨市| 古浪县| 余姚市| 金门县| 昭觉县| 永仁县| 镶黄旗| 潜山县| 芦山县| 简阳市| 华安县| 兴安盟| 达日县| 全州县| 衡东县| 霍林郭勒市| 兴仁县| 天柱县| 明溪县| 洞头县| 巴青县| 北碚区| 新河县| 隆安县| 禄劝| 稻城县| 慈溪市| 赤城县| 九龙坡区| 郸城县| 富源县| 大兴区| 滁州市| 九龙城区| 建宁县| 临沭县| 迁安市| 睢宁县|