Android 快捷启动图标
来源:互联网 发布:brew mysql 编辑:程序博客网 时间:2024/06/02 03:08
Android 快捷启动图标
核心代码
Intent shortcut = new Intent("com.android.launcher.action.INSTALL_SHORTCUT");//不允许重复创建shortcut.putExtra("duplicate", false)//需要实现的名称shortcut.putExtra(Intent.EXTRA_SHORTCUT_NAME, strName);//快捷图片Parcelable icon = Intent.ShortcutIconResource.formContext(context, iconResId);shortcut.putExtra(Intent.EXTRA_SHORTCUT_RESOURCE, icon);//点击快捷图片,运行程序Intent intent = new Intent(context.getApplicationContext(),MainActivity.class);intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);//Android启动模式 清除当前activity main 及以上的 activity 并从新创建 MainActivity;shortcut.putExtra(Intent.EXTRA_SHORTCUT_INTENT, intent);
需要注意
被启动的 activity 必须是默认启动的ac
<intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter>
阅读全文
0 0
- Android 快捷启动图标
- Android 快捷启动图标
- Android创建快捷图标
- android 创建快捷图标demo
- Android 创建桌面快捷图标
- Android生成桌面快捷图标
- linux创建桌面快捷启动图标
- Android APP自动生成桌面快捷图标 启动方式有差异
- android 在应用程序中添加快捷图标
- 创建,删除快捷图标shortcut android
- 创建,删除快捷图标shortcut android
- android应用创建桌面快捷图标
- android判断是否已经存在快捷图标
- Android创建和删除快捷图标
- 创建,删除快捷图标shortcut android .
- android 创建的删除快捷图标
- android 如何创建快捷小图标
- Android应用创建桌面快捷图标
- JavaScript之事件处理(监听)函数
- Android开发:ListView、AdapterView、RecyclerView全面解析
- java工厂模式
- Knights of the Round Table POJ
- ViewBag 在cshtml中的判断
- Android 快捷启动图标
- android:网页访问Activity出现错误:error unknown url scheme
- linux初学之文件归档压缩及传输
- JZOJ5418. 【NOIP2017提高A组集训10.24】 树形DP+组合数
- 数据库四大特性与四种隔离级别
- parallel programming in java introduce
- 第八周LeetCode算法题两道
- 如何php开启CURL支持
- dede学习-增加文章内容