android桌面快捷方式跳转到指定activity
AndroidManifest.xml 应用主入口配置:
<activity
android:name="com.*.cust.contacts.MainActivity"
android:exported="true"
android:label="@string/app_name"
android:screenOrientation="portrait" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<!-- 自己定义的action,通过自己定义的action能够应用内调用 -->
<action android:name="*.intent.action.SHORTCUT" /> <category android:name="android.intent.category.LAUNCHER" />
<!-- 必须加上这个。否则无法直接使用自定的action -->
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
创建快捷方式:
// 自己定义action
Intent intent = new Intent("*.intent.action.SHORTCUT");
Bundle bundle = new Bundle();
// 能够依据传递參数运行对应操作
bundle.putString("needgoto", "*activity");
intent.putExtras(bundle);
// 创建桌面快捷方式
Intent shortcutintent = new Intent("com.android.launcher.action.INSTALL_SHORTCUT");
// 是否同意反复创建
shortcutintent.putExtra("duplicate", true);
// 须要显示的名称
shortcutintent.putExtra(Intent.EXTRA_SHORTCUT_NAME, getString(R.string.app_name_1));
// 快捷图片
Parcelable icon = Intent.ShortcutIconResource.fromContext(getApplicationContext(), R.drawable.ic_launcher);
shortcutintent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, icon);
// 点击快捷图片,运行的程序主入口
shortcutintent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, intent);
// 发送广播运行操作
sendBroadcast(shortcutintent);
android桌面快捷方式跳转到指定activity的更多相关文章
- Android桌面快捷方式那些事与那些坑
原文来自http://blog.zanlabs.com/2015/03/14/android-shortcut-summary/ 将近二个多月没写博客了.之前一段时间一直在搞红包助手,就没抽时间写博客 ...
- Android Webview 调用JS跳转到指定activity
JAVA: WebView wv; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(save ...
- Android first --- 页面跳转及数据传递
页面跳转即数据传递 创建第二个界面Acivity *需要在清单文件中添加配置一个Actuvity标签 标签中如果带有这个子节点,则会在Android中添加一个快捷图标 <intent-filte ...
- Android随笔之——跨进程通信(一) Activity篇
在Android应用开发中,我们会碰到跨进程通信的情况,例如:你用QQ通讯录打电话的时候会调用系统的拨号应用.某些新闻客户端可以将新闻分享到QQ.微信等应用,这些都是跨进程通信的情况.简而言之,就是一 ...
- Android 点击桌面快捷方式和Notifycation跳转到Task栈顶Activity
我们一般下载的应用在第一次启动应用的时候都会给我创建一个桌面快捷方式,然后我在网上找了些资料整理下了,写了一个快捷方式的工具类,这样我们以后要创建快捷方式的时候直接拷贝这个类,里面提供了一些静态方法, ...
- Android 发送多个不同的快捷方式(shortcut)到桌面并向其启动的Activity传参
需求: 对于创建快捷方式到桌面,网上能查到不少资料,但一般都是针对应用程序本身的. 前阵子在做项目时,遇到了一个类似于百度贴吧里面的一个需求:对于每个具体的贴吧,都可以将其发送到桌面(HomeScre ...
- Android 添加桌面快捷方式操作
/** * 为程序创建桌面快捷方式 */ private void addShortcut(){ Intent shortcut = new Intent(“com.android.launcher. ...
- Android开发被添加到桌面快捷方式
Android开发被添加到桌面快捷方式 对于一个希望拥有很多其它用户的应用来说.用户桌面能够说是全部软件的必争之地,假设用户在手机桌面上建立了该软件的快捷方式.用户将会更频繁地使用该软件. 因此,全部 ...
- android 关闭多个或指定activity
打开了.activityA,B,C,D,...然后到E一起关闭前面所有activity(转自:http://blog.csdn.net/lengguoxing/article/details/4214 ...
随机推荐
- dialogic d300语音卡驱动重装后启动报错问题解决方法
dialogic d300 驱动重装后 dlstart 报错解决 问题描述:dlstart 后如下报错 [root@BJAPQ091 data]#dlstop Stopping Dialogic ...
- day6 - 面向对象学习
面向对象介绍 特性 class object 封装 继承 https://segmentfault.com/a/1190000002685939 python2 经典类是按照深度优先来继承的:新式类是 ...
- URAL - 1920 Titan Ruins: the Infinite Power of Magic(乱搞)
搞死人的题目,,, 就是在n*n的方格中找路径长度为L的回路. 开始的思路值适合n为偶数的情况,而忽视了奇数的case,所以wa了一次. 然后找奇数case的策略,代码从70多行变成了100多,然后改 ...
- CentOS 一个网卡设置多个IP
方法1:少量IP手动绑定: (这里以绑定IP到eth0为例,其它网卡的话修改相应的文件名即可) 1.复制ifcfg-eth0的网卡配置文件并改名为ifcfg-eth0:0 [root@akinlau ...
- [Phalcon-framework] Phalcon framework - Dependency Injection/Service Location And the MVC architecture note 1
Registering services in the Container - We can easily replace a component with one created by oursel ...
- Entity Framework 4、5 多字段排序
public interface IOrderByExpression<TEntity> where TEntity : class { IOrderedQueryable<TEnt ...
- 【Leetcode】【Medium】Decode Ways
A message containing letters from A-Z is being encoded to numbers using the following mapping: 'A' - ...
- Visual Studio 2013 新功能 Memory Dump 分析器
本文为 Dennis Gao 原创技术文章,发表于博客园博客,未经作者本人允许禁止任何形式的转载. TechEd2013 发现新功能 12月5日和6日,在国家会议中心参加了微软的 TechEd2013 ...
- C#与数据库访问技术总结(十一)之数据阅读器(DataReader)1
数据阅读器 当执行返回结果集的命令时,需要一个方法从结果集中提取数据. 处理结果集的方法有两个: 第一,使用数据阅读器(DataReader): 第二,同时使用数据适配器(Data Adapter)和 ...
- web前端基础——补充
1 布局和事件 布局效果如下(标题和内容都居中,两边留空白) 布局代码如下 <!DOCTYPE html> <html lang="en"> <he ...