Android创建桌面快捷方式
来源:互联网 发布:海尔d29fa10 akm数据 编辑:程序博客网 时间:2024/05/03 11:26
一、创建快捷方式的代码
/** * 创建快捷方式 * * @param name 快捷方式的名字 * @param resourceId 快捷方式的图标 * @param phone 电话号码 */ public void createShortCut(String name, int resourceId, String phone) { //创建快捷方式的Intent Intent shortcutintent = new Intent("com.android.launcher.action.INSTALL_SHORTCUT"); //不允许重复创建 shortcutintent.putExtra("duplicate", false); //需要现实的名称 shortcutintent.putExtra(Intent.EXTRA_SHORTCUT_NAME, name); //快捷方式的图标 Parcelable icon = Intent.ShortcutIconResource.fromContext(getApplicationContext(),resourceId); shortcutintent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, icon); //点击快捷图片,运行的程序主入口,并添加要做的 Intent todo = new Intent(Intent.ACTION_CALL, Uri.parse("tel:" + phone)); shortcutintent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, todo); //发送广播。OK sendBroadcast(shortcutintent); }二、添加权限
<uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT" /> <uses-permission android:name="com.android.launcher.permission.UNINSTALL_SHORTCUT" />
1 0
- android 创建桌面快捷方式
- Android 创建桌面快捷方式
- android创建桌面快捷方式
- Android 创建桌面快捷方式
- android 创建桌面快捷方式
- Android 创建桌面快捷方式
- Android创建桌面快捷方式
- android 创建桌面快捷方式
- Android 创建桌面快捷方式
- Android 创建桌面快捷方式
- Android 创建桌面快捷方式
- Android:桌面创建快捷方式
- Android创建桌面快捷方式
- android 创建桌面快捷方式
- Android创建桌面快捷方式
- android 创建桌面快捷方式
- Android创建桌面快捷方式
- Android创建桌面快捷方式
- 加密方式-非对称加密(RSA加密与签名)
- 使用dotcloud免费ssh
- 【Android开发VR实战】三.开发一个寻宝类VR游戏TreasureHunt
- web.xml中load-on-startup的作用
- struts2的自定义标签
- Android创建桌面快捷方式
- 好文章分享--《组件化与业务拆分那些事》
- 关于宗函数f(t)下的一对单边函数的拉普拉斯的正反变换中左,右边函数的相关求法,证明及相关定义,补充Z变换的同理求法
- python 中的全局变量和局部变量
- Spring、Spring MVC、MyBatis整合文件配置详解
- lighttpd + php for android 安卓上的WEB服务器
- springmvc 集成rabbitmq,实现RPC通信方式
- 几种简单的负载均衡算法及其 Java 代码实现
- 批处理