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

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

 更新時(shí)間:2015年06月09日 11:21:26   投稿:junjie  
這篇文章主要介紹了Android中創(chuàng)建快捷方式及刪除快捷方式實(shí)現(xiàn)方法,本文直接給出實(shí)現(xiàn)代碼,需要的朋友可以參考下
/**
	 * 
	 * 創(chuàng)建快捷方式
	 * @param map 快捷方式圖標(biāo)
	 * @param appName 快捷方式標(biāo)題
	 * @param appUrl 快捷方式打開的地址
	 * @param iconUrl 快捷方式圖標(biāo)地址
	 * 
	 * */
	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);// 設(shè)置是否重復(fù)創(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);// 設(shè)置第一個(gè)頁面
		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 絕對(duì)路徑如: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);
  }

相關(guān)文章

最新評(píng)論

沧州市| 偃师市| 仁化县| 福清市| 紫阳县| 商丘市| 浮山县| 萨嘎县| 修文县| 华坪县| 泸定县| 缙云县| 庆城县| 洛南县| 武夷山市| 龙井市| 保德县| 谢通门县| 和林格尔县| 耒阳市| 梓潼县| 小金县| 沧州市| 成安县| 武定县| 蒲城县| 南溪县| 楚雄市| 高州市| 莱州市| 甘南县| 湟中县| 泾源县| 任丘市| 七台河市| 汶川县| 塔城市| 昌宁县| 武宣县| 元朗区| 德安县|