zoukankan      html  css  js  c++  java
  • 在桌面添加快捷方式

    在桌面添加快捷方式

    	/**
    	 * 在桌面添加快捷方式
    	 * @param icon 快捷方式图标
    	 * @param name 快捷方式名称
    	 * @param url 快捷方式的intent url
    	 */
    	private void addShortcut(Parcelable icon, String name, String url){
    		try {
    //			Intent intentAddShortcut = new Intent(Intent.ACTION_CREATE_SHORTCUT);
    			Intent intentAddShortcut = new Intent("com.android.launcher.action.INSTALL_SHORTCUT");
    			//添加名称
    			intentAddShortcut.putExtra(Intent.EXTRA_SHORTCUT_NAME, name);
    			//添加图标
    			intentAddShortcut.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, icon);
    			//设置Launcher的Uri数据
    			Intent intentLauncher = new Intent();
    			intentLauncher.setAction("android.intent.action.VIEW");      
    			Uri content_url = Uri.parse(url);     
    			intentLauncher.setData(content_url); 
    			//添加快捷方式的启动方法
    			intentAddShortcut.putExtra(Intent.EXTRA_SHORTCUT_INTENT, intentLauncher);
    			sendBroadcast(intentAddShortcut);       
    		} catch (Exception e) {
    			LogUtil.e(tag, e);
    		}
    	}
    
  • 相关阅读:
    学指令 emacs篇
    c 排序 总结
    C# WinForm源码下载
    PetShop下载
    Visual Studio常用技巧
    人事信息管理系统(PMS)
    css实现细表格原理
    GridView导出Excel/Word
    dotnet程序员装机必备工具
    容器练习一
  • 原文地址:https://www.cnblogs.com/code4app/p/4451352.html
Copyright © 2011-2022 走看看