Android Studio中PendingIntent.getBroadcasphpcms get标签红,提示connot resolve symbol

 上传我的文档
 下载
 收藏
该文档贡献者很忙,什么也没留下。
 下载此文档
正在努力加载中...
【精品】全《Android平台开发之旅》第15章
下载积分:750
内容提示:【精品】全《Android平台开发之旅》第15章
文档格式:DOC|
浏览次数:2|
上传日期: 02:38:44|
文档星级:
全文阅读已结束,如果下载本文需要使用
 750 积分
下载此文档
该用户还上传了这些文档
【精品】全《Android平台开发之旅》第15章
关注微信公众号关于android中PendingIntent.getBroadcase的注册广播
获得PendingIntent,浏览了各类文章,大多数说了这种方法,但是基本上也就是止步于此,可是还有最重要的没有谈及,如何区别多个已注册的PendingIntent呢,看了一下PendingIntent.getBroadcast的javadoc,第四个参数flags意为标记,初步认为flags是标识各个PendingIntent的,于是在测试中设置了个全局变量
然后用currentIntent++作为第四个参数传递进去,测试,注册了两个监听,等待时间的到来,bingo,居然可以了,目测已经可以。可是继续深入时问题来了,我要传递参数怎样?正解做法就是在第三个参数中设置
然后在自己实现的Receiver里用传进来的参数Intent intent实现
就可以获得参数,可以真正在实现的时候发现,在receiver里始终取不到参数,再经过一番查找,发现要把PendingIntent.getBroadcast的第四个参数设置于PendingIntent.FLAG_UPDATE_CURRENT,设置后测试,果然可以,可是这样问题又出来了,又要如何区别注册的intent呢?再次查看getBroadcast的javadoc,几个参数都没有说明如何区别要注册的PendingIntent,反而看到第二个参数的说明很神奇,就是这个参数目前为保留状态,仍未用到,无奈中,继续search各种说法,才发现,用requestCode来区别居然是可以的(可是为什么javadoc要说该参数未被使用呢?不解;估计用于区分PendingIntent的方法就是其中任意一个参数不同便可以区分了)代码如下:
Receiver中获取传递的数据:
已投稿到:
以上网友发言只代表其个人观点,不代表新浪网的观点或立场。android抢红包代码解析支持微信与QQ
日期: 14:07:47
来源:ITeye
android抢红包代码解析支持微信与QQ
最近有一段时间没写博客了,一方面是工作比较忙,一方面也着实本人水平有限,没有太多能与大家分享的东西,也就是在最近公司要做一个抢红包的功能,老板发话了咋们就开干呗,本人就开始在网上收集资料,经过整理和实践,总算完美实现了功能,这里拿出本人一点微薄的成就与大家分享。
首先界面是这样的
开启自动抢红包只需点击相应的选项即可,下面我们进入正题,实现自动抢红包的原理,其实是借助android下的一个辅助服务AccessibilityService,这个服务是google公司为许多Android使用者因为各种情况导致他们要以不同的方式与手机交互。这包括了有些用户由于视力上,身体上,年龄上的问题致使他们不能看完整的屏幕或者使用触屏,也包括了无法很好接收到语音信息和提示的听力能力比较弱的用户。Android提供了Accessibility功能和服务帮助这些用户更加简单地操作设备,包括文字转语音(这个不支持中文),触觉反馈,手势操作,轨迹球和手柄操作。
而开发者可以利用这些服务使得程序更好用,我们来看代码:
android:name="com.hxwl.qhb.service.QiangHongBaoService"
android:enabled="true"
android:exported="true"
android:label="XXXX"
android:permission="android.permission.BIND_ACCESSIBILITY_SERVICE" &
&intent-filter&
&action android:name="android.accessibilityservice.AccessibilityService" /&
&/intent-filter&
&meta-data
android:name="android.accessibilityservice"
android:resource="@xml/qianghongbao_service_config" /&
&/service&
以上内容配置在AndroidManifest中,qianghongbao_service_config内容如下
&?xml version="1.0" encoding="utf-8"?&
&accessibility-service
xmlns:android="/apk/res/android"
android:description="@string/accessibility_description"
android:accessibilityEventTypes="typeNotificationStateChanged|typeWindowStateChanged|typeWindowContentChanged|typeWindowsChanged"
android:packageNames="com.tencent.mm,com.tencent.mobileqq"
android:accessibilityFeedbackType="feedbackGeneric"
android:notificationTimeout="100"
android:accessibilityFlags="flagDefault"
android:canRetrieveWindowContent="true"/&
android:description 这个是设置服务的描述,在用户授权的界面可以看到。
android:accessibilityEventTypes 这个是配置要监听的辅助事件,我们只需要用到typeNotificationStateChanged(通知变化事件)、typeWindowStateChanged(界面变化事件)
android:packageNames 这个是要监听应用的包名,如果要监听多个应用,则用","去分隔
android:accessibilityFeedbackType 这个是设置反馈方式,方式有如下几种
android:accessibilityFeedbackType="feedbackGeneric"通用的反馈类型
android:notificationTimeout="100"为事件回调的延迟时间
android:accessibilityFlags="flagDefault"默认标记
android:canRetrieveWindowContent="true"如果不设为true,AccessibilityEvent.getSource()获取的对象即为空
AccessibilityService类主要有以下四个方法:
public void onAccessibilityEvent(AccessibilityEvent event) {
//接收事件,如触发了通知栏变化、界面变化等
protected boolean onKeyEvent(KeyEvent event) {
//接收按键事件
return super.onKeyEvent(event);
public void onInterrupt() {
//服务中断,如授权关闭或者将服务杀死
protected void onServiceConnected() {
super.onServiceConnected();
//连接服务后,一般是在授权成功后会接收到
当我们监听的包名发生通知或界面改变时,就会被onAccessibilityEvent方法捕抓到,我们先看看微信的实现:
public void onReceiveJob(AccessibilityEvent event) {
final int eventType = event.getEventType();
if (eventType == AccessibilityEvent.TYPE_NOTIFICATION_STATE_CHANGED) {// 通知栏事件
Parcelable data = event.getParcelableData();
if (data == null || !(data instanceof Notification)) {
// 开启快速模式,不处理
if (QiangHongBaoService.isNotificationServiceRunning() && getConfig().isEnableNotificationService()) {
List&CharSequence& texts = event.getText();
if (!texts.isEmpty()) {
String text = String.valueOf(texts.get(0));
notificationEvent(text, (Notification) data);
} else if (eventType == AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED) {// 界面改变事件
openHongBao(event);
} else if (eventType == AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED) {// 界面内容改变事件
if (mCurrentWindow != WINDOW_LAUNCHER) { // 不在聊天界面或聊天列表,不处理
if (isReceivingHongbao) {
handleChatListHongBao();
这里我们做了简单的封装,onAccessibilityEvent方法触发时,便会进入AccessibilityEvent传入onReceiveJob方法中,在该方法中分别处理了通知栏事件,界面改变事件,界面内容改变事件,我们逐个看。
通知栏事件中,我们进行了判空,并拦截快速模式,重点是event.getText()获取通知中的文本,进行判断:
/** 所有通知栏事件,都在该方法处理 */
private void notificationEvent(String ticker, Notification nf) {
String text =
int index = text.indexOf(":");
if (index != -1) {
text = text.substring(index + 1);
text = text.trim();
if (text.contains("[微信红包]")) { // 红包消息
newHongBaoNotification(nf);
如果有[微信红包]字眼,便进入下一步处理
/** 打开通知栏消息 */
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
private void newHongBaoNotification(Notification notification) {
isReceivingHongbao =
// 以下是精华,将微信的通知栏消息打开
PendingIntent pendingIntent = notification.contentI
boolean lock = NotifyHelper.isLockScreen(getContext());
if (!lock) {// 未锁,自动点开通知
NotifyHelper.send(pendingIntent);
} else {// 锁屏,显示通知,微信自带,不作任何处理
NotifyHelper.showNotify(getContext(), String.valueOf(notification.tickerText), pendingIntent);
// 锁屏 || 模式非自动抢
if (lock || getConfig().getWechatMode() != Config.WX_MODE_0) {
// 开启声音,震动提示
NotifyHelper.playEffect(getContext(), getConfig());
获取到PendingIntent,并判断当前是否锁屏,这里主要用到了
/** 执行PendingIntent事件 */
public static void send(PendingIntent pendingIntent) {
pendingIntent.send();
} catch (PendingIntent.CanceledException e) {
e.printStackTrace();
该方法可以执行模拟点击,如同点击了红包通知一般,这样就会触发下一个内容改变事件
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
private void openHongBao(AccessibilityEvent event) {
if ("com.tencent.mm.plugin.luckymoney.ui.LuckyMoneyReceiveUI".equals(event.getClassName())) {
mCurrentWindow = WINDOW_LUCKYMONEY_RECEIVEUI;
// 点中了红包,下一步就是去拆红包
handleLuckyMoneyReceive();
} else if ("com.tencent.mm.plugin.luckymoney.ui.LuckyMoneyDetailUI".equals(event.getClassName())) {
mCurrentWindow = WINDOW_LUCKYMONEY_DETAIL;
// 拆完红包后看详细的纪录界面
if (getConfig().getWechatAfterGetHongBaoEvent() == Config.WX_AFTER_GET_GOHOME) { // 返回主界面,以便收到下一次的红包通知
AccessibilityHelper.performHome(getService());
} else if ("com.tencent.mm.ui.LauncherUI".equals(event.getClassName())) {
mCurrentWindow = WINDOW_LAUNCHER;
// 在聊天界面,去点中红包
handleChatListHongBao();
mCurrentWindow = WINDOW_OTHER;
我们根据当前的activity判断下一步处理
* 收到聊天里的红包
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2)
private void handleChatListHongBao() {
int mode = getConfig().getWechatMode();
if (mode == Config.WX_MODE_3) { // 只通知模式
AccessibilityNodeInfo nodeInfo = getService().getRootInActiveWindow();
if (nodeInfo == null) {
if (mode != Config.WX_MODE_0) {// 非自动抢
boolean isMember = isMemberChatUi(nodeInfo);
if (mode == Config.WX_MODE_1 && isMember) {// 过滤群聊
} else if (mode == Config.WX_MODE_2 && !isMember) { // 过滤单聊
// 下面就是,激动人心的抢红包代码
List&AccessibilityNodeInfo& list = nodeInfo.findAccessibilityNodeInfosByText("领取红包");
if (list != null && list.isEmpty()) {// "领取红包"关键字节点获取不到
// 从消息列表查找红包
AccessibilityNodeInfo node = AccessibilityHelper.findNodeInfosByText(nodeInfo, HONGBAO_TEXT_KEY);
if (node != null) {
isReceivingHongbao =
AccessibilityHelper.performClick(node);
} else if (list != null) {
if (isReceivingHongbao) {
// 最新的红包领起
AccessibilityNodeInfo node = list.get(list.size() - 1);
AccessibilityHelper.performClick(node);
isReceivingHongbao =
同样根据判断关键文本进入模拟点击,然后再次触发界面改变事件
* 点击聊天里的红包后,显示的界面
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
private void handleLuckyMoneyReceive() {
AccessibilityNodeInfo nodeInfo = getService().getRootInActiveWindow();
AccessibilityNodeInfo targetNode =
int event = getConfig().getWechatAfterOpenHongBaoEvent();
int wechatVersion = getWechatVersion();
if (event == Config.WX_AFTER_OPEN_HONGBAO) { // 拆红包
if (wechatVersion & USE_ID_MIN_VERSION) {
targetNode = AccessibilityHelper.findNodeInfosByText(nodeInfo, "拆红包");
String buttonId = "com.tencent.mm:id/b43";
if (wechatVersion == 700) {
buttonId = "com.tencent.mm:id/b2c";
if (buttonId != null) {
targetNode = AccessibilityHelper.findNodeInfosById(nodeInfo, buttonId);
if (targetNode == null) {
// 分别对应固定金额的红包 拼手气红包
AccessibilityNodeInfo textNode = AccessibilityHelper.findNodeInfosByTexts(nodeInfo, "发了一个红包", "给你发了一个红包", "发了一个红包,金额随机");
if (textNode != null) {
for (int i = 0; i & textNode.getChildCount(); i++) {
AccessibilityNodeInfo node = textNode.getChild(i);
if ("android.widget.Button".equals(node.getClassName())) {
targetNode =
if (targetNode == null) { // 通过组件查找
targetNode = AccessibilityHelper.findNodeInfosByClassName(nodeInfo, "android.widget.Button");
} else if (event == Config.WX_AFTER_OPEN_SEE) { // 看一看
if (getWechatVersion() & USE_ID_MIN_VERSION) { // 低版本才有 看大家手气的功能
targetNode = AccessibilityHelper.findNodeInfosByText(nodeInfo, "看看大家的手气");
} else if (event == Config.WX_AFTER_OPEN_NONE) {// 静静地看着
if (targetNode != null) {
final AccessibilityNodeInfo n = targetN
long sDelayTime = getConfig().getWechatOpenDelayTime();
if (sDelayTime != 0) {
getHandler().postDelayed(new Runnable() {
public void run() {
AccessibilityHelper.performClick(n);
}, sDelayTime);
AccessibilityHelper.performClick(n);
微信中有两种红包,一种是固定金额的红包,还有一种是拼手气红包,两个的关键字不同,我们分开判断。
QQ的实现也基本相同,我们直接上代码
public void onReceiveJob(AccessibilityEvent event) {
openRed(event);
private void openRed(AccessibilityEvent event) {
this.rootNodeInfo = event.getSource();
if (rootNodeInfo == null) {
mReceiveNode =
checkNodeInfo();
/* 如果已经接收到红包并且还没有戳开 */
if (mLuckyMoneyReceived && (mReceiveNode != null)) {
int size = mReceiveNode.size();
if (size & 0) {
String id = getHongbaoText(mReceiveNode.get(size - 1));
long now = System.currentTimeMillis();
if (this.shouldReturn(id, now - lastFetchedTime))
lastFetchedHongbaoId =
lastFetchedTime =
AccessibilityNodeInfo cellNode = mReceiveNode.get(size - 1);
if (cellNode.getText().toString().equals("口令红包已拆开")) {
cellNode.getParent().performAction(AccessibilityNodeInfo.ACTION_CLICK);
if (cellNode.getText().toString().equals(QQ_HONG_BAO_PASSWORD)) {
AccessibilityNodeInfo rowNode = getService().getRootInActiveWindow();
if (rowNode == null) {
recycle(rowNode);
mLuckyMoneyReceived =
@TargetApi(Build.VERSION_CODES.KITKAT)
public void recycle(AccessibilityNodeInfo info) {
if (info.getChildCount() == 0) {
/* 这个if代码的作用是:匹配“点击输入口令的节点,并点击这个节点” */
if (info.getText() != null && info.getText().toString().equals(QQ_CLICK_TO_PASTE_PASSWORD)) {
info.getParent().performAction(AccessibilityNodeInfo.ACTION_CLICK);
/* 这个if代码的作用是:匹配文本编辑框后面的发送按钮,并点击发送口令 */
if (info.getClassName().toString().equals("android.widget.Button") && info.getText().toString().equals("发送")) {
info.performAction(AccessibilityNodeInfo.ACTION_CLICK);
for (int i = 0; i & info.getChildCount(); i++) {
if (info.getChild(i) != null) {
recycle(info.getChild(i));
可见这是一个递归方法,反复获取节点并判断节点文本,模拟点击红包按钮。
因为是公司的项目,不方便给Demo,这里附上一个大神链接,我便是在大神的基础上作得更改,
本页内容版权归属为原作者,如有侵犯您的权益,请通知我们删除。
在实现该控件之前,先说一下该控件的难度, 一、
每个item中如果有RadioButton之类,可以focus焦点的,点击效果可能会失效
二、无限的滚动
下面是效果图: 实现上图的效果,一共自定义了两个 控件,viewpager+底部导航图标 下面我先来讲解一下,viewpager的实现: 1.初始化 pre name="code" class="java"/** 点击按下的坐标 **/PointF downP = new PointF();/** 当前按下的坐标 **/PointF curP
前言 入职接近半个多月,有几天空闲,所以想着能不能自己实现一个库来练练手,因为之前一直想要实现下拉刷新的功能,因此就有了这样一个自制的下拉刷新库——RefreshWidgetLib. 关于下拉刷新 下拉刷新,作为一个几乎每个应用都会出现的一种控件,不言而喻,它对于提高用户体验有着很重要的作用,而且也已经成为了人们习惯的一种操作。说起下拉刷新这种设计,最早的引入者是在2008年上线的Tweetie,Tweetie引入了如今随处可见的“下拉刷新”设计,不仅有多达数百款App Store应用使用这种设计,就连苹
AIDL是Android实现IPC的一种重要的方式,理解它的原理对理解Android进程间通信有很大的帮助。AIDL的定义,已经有很多介绍的文章了,这里就不做详解了。我们直接从实例入手来分析AIDL实现原理。 AIDL的使用 首先需要定义AIDL接口IMyService.aidl: // IMyService.aidl package com.chuck. // Declare any non-default types here with import statements inter
OC与Swift两种实现方式基本上区别不大,主要是在一些对象或方法的调用方式不同 OC代码样式: self.view.backgroundColor = [UIColor blackColor];
//加载颗粒状的火花图片
CAEmitterLayer *emitterLa = [CAEmitterLayer layer];
emitterLa.emitterPosition = CGPointMake(self.view.bounds.size.width/2, sel
前言 相信很多朋友在开发中都会遇到图片上传的情况,尤其是多图上传,最 经典的莫过于微信的图片选择了。所有很多情况下会使用到多图选择。 所以就有了这篇文章,今天抽点时间写了个控件。 支持自定义选择图片的样式 支持设置图片选择数量 支持图片预览,删除 支持图片拍照 先来看看效果 实现分析 假如不定义控件,我们要实现这样一个功能,无非是写个GridView在item点击的时候去显示图片进行选择,在返回界面的时候进行GridView的数据刷新。我们把这些逻辑写在我们自定义的GridView中,就成了一个新的控件。
在360对DroidPlugin的特点介绍中有云: 插件的四大组件完全不需要在Host程序中注册,支持Service、Activity、BroadcastReceiver、ContentProvider四大组件。 实现了进程管理,插件的空进程会被及时回收,占用内存低。 之所以支持Service,Activity,ContentProvider三大组件,是因为DroidPlugin在AndroidManifest文件中预先注册了8个运行插件的进程,每个进程预注册Service一个, ContentProvi
本篇介绍ListView控件,这是Android中比较重要也比较复杂的控件,这里只谈到使用ViewHolder机制优化即可。 一、ListView简介 ListView是Android系统中显示列表的控件,每个ListView都可以包含很多个列表项。 二、ListView的使用 概念不多说,直接来介绍使用方法。 ListView中比较复杂的是数据适配器,其作用是把复杂的数据(数组、链表、数据库、集合等)填充在指定视图界面,是连接数据源和视图界面的桥梁。常见的Android原生的适配器有ArrayAdapt
欢迎转载,转载请注明出处: http://blog.csdn.net/dmk877/article/details/
相信不管做了多长时间开发的人都用过Tween动画,从刚开始工作到现在我也是用了N次Tween动画,但是每一次使用总感觉掌握的不够全面,所以花了点时间详细的总结了下Tween动画,其实在android中熟练掌握动画,能够帮助我们实现一些非常酷炫的效果从而使我们的app在交互或者用户体验上有一个更好的体验,鉴于此详细的学习动画还是很有必要的,相信通过本篇的学习大家会对Twe
一、前言 本周有位入行开发不久的朋友问我回调究竟是个什么概念,在网上看了很多的回调函数解释,但是越看越乱。虽然回调函数这个梗已经不新鲜了,这里还是用书面的形式记录下。 如果有了解的,就无需再看。 二、概念 概念上,这里引用百度百科的解释,如下: 回调函数就是一个通过 函数指针 调用的函数。如果你把函数的 指针 (地址)作为 参数传递 给另一个函数,当这个指针被用来调用其所指向的函数时,我们就说这是回调函数。回调函数不是由该函数的实现方直接调用,而是在特定的事件或条件发生时由另外的一方调用的,用于对该事件或
接下来就进入聊天界面了,我的界面效果如下几个图所示: 这其中包括两个点:仿微信按住说话功能,表情管理 第一个,按住说话 按钮的功能,通过重写Button完成, /** * 控制录音Button * 1、重写onTouchEvent;(changeState方法、wantToCancel方法、reset方法); * 2、编写AudioDialogManage、并与该类AudioRecorderButton进行整合; * 3、编写AudioManage、并与该类AudioRecorderButton进行整合;
Copyright (C)
ITfish.netSDK Version: M5 Introduction In this tutorial we will create an application called PhoneFinder. This application will illustrate how to deal with sending and receiving SMS messages. The idea of the application is that when your phone is lost or stole
First, create the Android project Project name: SendMessage BuildTarget: Android2.1 Application name: Send SMS Package name: com.changcheng.Activity Create Activity: SendMessage Min SDK Version: 7 Second, the editing works 1. Edit strings.xml file sa
Activity Android in, Activity is the root of all programs, all of processes are running in the Activity among, Activity has its own life cycle (see /feisky/archive//1637427 . html, controlled by the system life cycle,
Activity Android中,Activity是所有程序的根本,所有程序的流程都运行在Activity之中,Activity具有自己的生命周期(见/feisky/archive//1637427.html,由系统控制生命周期,程序无法改变,但可以用onSaveInstanceState保存其状态). 对于Activity,关键是其生命周期的把握(如下图),其次就是状态的保存和恢复(onSaveInstanceState onR
Android中,Activity是所有程序的根本,所有程序的流程都运行在Activity之中,Activity具有自己的生命周期(见/feisky/archive//1637427.html,由系统控制生命周期,程序无法改变,但可以用onSaveInstanceState保存其状态). 对于Activity,关键是其生命周期的把握(如下图),其次就是状态的保存和恢复(onSaveInstanceState onRestoreIns
Android系列之Intent传递对象的几种实例方法,需要的朋友可以参考一下 在Android中intent传递对象主要有2种方式分别是,Bundle.putSerializable(Key,Object)和Bundle.putParcelable(Key, Object);当然这些Object是有一定的条件的,前者是实现了Serializable接口,而后者是实现了Parcelable接口,以下是我为大家做的一个实例 首先我们建立一个工程项目命名为:ObjectTestDemo 然后我们再修
一.几个关键概念 1.MessageQueue:是一种 数据 结构,见名知义,就是一个消息队列,存放消息的地方.每一个线程最多只可以拥有一个MessageQueue数据结构. 创建一个线程的时候,并不会 自动 创建其MessageQueue.通常使用一个Looper对象对该线程的MessageQueue进行管理.主线程创建时,会创建一 个默认的Looper对象,而Looper对象的创建,将自动创建一个Message Queue.其他非主线程,不会自动创建Looper,要需要的时候,通过调 用pr
I try to give the example for learning how to use the intent to redirect one activity to other activity. Environment: android 4.0 elipse 3.62 jdk 1.6.0_26 First ,create two activities,Activity1 and Activity2(from activity1 to activity2) src/Activity1
&LinearLayout android:id=&@+id/information_plate& android:layout_width=&fill_parent& android:layout_height=&wrap_content& android:orientation=&horizontal& android:background=&@drawable/scrolling_message&quot
I can text message fees from a hair into a 1 minute, there is no mobile phone manufacturers to use my text messaging protocol. QQ:
Many users may be directly to your J2ME project ported to Android platform blunt, in fact, Google provides us with a good file size and time and date parsing class, which is located android.text.format this package, it provides a powerful analytical
1. Message Queue role l Android in your program, the new to create a thread, or threads (Thread) time, and does not automatically establish the Message Loop. l Android is not in the Message Queue Global data structure, for example, different objects
在一个Android应用中,主要是由四种组件组成的,这四种组件可参考&Android应用的构成&.而这四种组件是独立的,它们之间可以互相调用,协调工作,最终组成一个真正的Android应用.在这些组件之间的通讯中,主要是由Intent协助完成的.Intent负责对应用中一次操作的动作.动作涉及数据.附加数据进行描述,Android则根据此Intent的描述,负责找到对应的组件,将 Intent传递给调用的组件,并完成组件的调用.因此,Intent在这里起着一个媒体中介的作用,专门提供组
Android基本的设计理念是鼓励减少组件间的耦合,因此Android提供了Intent (意图) ,Intent提供了一种通用的消息系统,它允许在你的应用程序与其它的应用程序间传递Intent来执行动作和产生事件.Intent作为联系各Activity之间的纽带,其作用并不仅仅只限于简单的数据传递.通过其自带的属性,其实可以方便的完成很多较为复杂的操作.例如直接调用拨号功能.处理接收短信,诸如此类,都可以通过设置Intent属性来完成. Intent主要有以下四个重要属性,它们分别为: Act
The first approach, using action to jump. 1, using Action jump, if there is a program AndroidManifest.xml an Activity in a defined segment of IntentFilter that contains the same Action then this Intent with this goal Action matches. If this IntentFil
Activity Android in, Activity is the basic of all procedures, all of processes are being run in Activity, Activity has its own life cycle (see /feisky/archive//1637427 . html, controlled by the system life cycle, the p
Start-ups often troubles us is when some of the problems have been easy to solve, often we would spend much effort to find a solution, the last to know that so simple, this is the result of the English world. Intent on Android application development
Java code Notification n = new Notification (R.drawable.face_1, &Service started&, System.currentTimeMillis ()); PendingIntent contentIntent = PendingIntent.getActivity (this, 0, new Intent (this, TServiceHolder. Class), 0); n.setLatestEventInfo
介绍Android中Intent的各种常见作用. 1 Intent.ACTION_MAIN String: android.intent.action.MAIN 标识Activity为一个程序的开始.比较常用. Input:nothing Output:nothing & activity android:name =&.Main& android:label =&@string/app_name& & & intent-filter & &
SMS implementations android average user would need time to adapt to the use of get used to, will andorid SMS mode set in our usual (general user) habits. View pictures in the process of character change can guess the expression of the principle of T
这篇文章主要介绍了android中intent的action属性使用示例,提供了使用intent拨打电话.发送短信.播放mp3的代码 Action :规定了Intent要完成的动作,是一个字符串常量.使用setAction()来设置Action属性,使用getAction()来获得Action属性.既可以使用系统内置的Action,也可以自己定义.系统自定义的action,如ACTION_VIEW, ACTION_EDIT, ACTION_MAIN等等. 1.自定义Action 在&目的Acti
1. Message Queue role l in your Android program, the new birth of a thread, or thread (Thread), we will not automatically establish its Message Loop. l Android, and there is no Global Village of the Message Queue data structure, for example, differen
Safe to say that in the past 20 years, selling a mobile phone have each SMS message function. In fact, SMS mobile phone message is a killer application that provides mobile operators to create a stable revenue source. Understand how to use your appli
0 _id 1 thread_id in the SMS screen displayed on the first of several groups (the same message a contact line in the agreement), the English name of topic. 2 address line, please 3 person? Existing phone book name. Maybe 4 date Date 5 protocol? .. 6
1. Review the role Message Queue In the previous years, introduced the Android's Thread, Looper, Message Queue, and the relationship between the four Handler. First review as follows: l UI thread is usually the main thread, and Android to start a pro
How to start an application in another application installed How an application through an event, try to start another application has been installed. //----- Before the core part-----name parameter is the application's package name , The latter is t
MessageQueue:消息队列,使用FIFO规则执行,每一个线程只可以拥有一个MessageQueue,在创建Looper对象会创建一个 MessageQueue用来容纳Message队列的,其中的Message是由Looper来分发的,Message不能直接添加到MessageQueue中,而是要通过与Looper关联的Handler去添加. 创建一个线程的时候,并不会自动创建其MessageQueue.通常使用一个Looper对象对该线程的MessageQueue进行管理.主线程创建时,
intent最主要的特点是它是一个用户概念.像所有其它ANDROID概念一样,不能从系统的角度去理解它.应该从用户的角度去理解它.意思是,当我们要解释某一个东西的时候,不是说,这个在系统中的功能是......而是说,这个是......换句话说,既然是Android,自然要说&人&话. intent另一个特点是它的内涵:意图,意欲.意思是,它所表达的全部就只是一个&我想要...(什么)&这样的概念.可以用消息来解释它的存在,说:哦!我明白了,它就是消息嘛!但是这样说是
In the seam using the rich text editor can be used richfaces editor component, rich: editor component function has been quite perfect, and what needs to be customized toolbar. &rich:editor& is based entirely on the TinyMCE website, which is based Ja
3. From the main thread to send a message to the child thread (Continued) The example above, the child thread by sending messages to the main thread. This section describes how to send a message to the main thread from child thread. The methods were:
Intent The last chapter we learn Activity, that some may question, Activity How to achieve between the jump, or how to achieve switching between screens. The question asked quite a standard. First, that we first understand the Androd System Activity
categories: Android 在Android开发中,我们常用的布局方式主要有LinearLayout.RelativeLayout.FrameLayout等,通过这些布局我们可以实现各种各样的界面.与此同时,如何正确.高效的使用这些布局方式来组织UI控件,是我们构建优秀Android App的主要前提之一.本篇内容就主要围绕Android布局优化来讨论在日常开发中我们使用常用布局需要注意的一些方面,同时介绍一款SDK自带的UI性能检测工具HierarchyViewer. 布局原则 通
intent是一个内容,是用来被传送的东西.而广播是一个行为.它也可以是一个内容.但这时候的内容是更高一层次的intent内容.它仍然是一个intent.intent与广播并没有本质上的区别.也正由此才引发它们之间的什么区别的疑问. 使用一个intent,你可以调用任何Activity.而使用一个广播具有&完全相同&的能力.那我们为什么还需要广播呢? 因为系统中存在的并不只有调用一个问题.intent是可以用来解决任何调用问题,但它解决不了通知的问题.而调用与通知显然是不一样的东西.调
DateFormat.format(dateFormat, calendar)方法的使用: 关键是dateFormat这个字符串的格式: 在这个函数里,一般使用的格式是yyyy MM dd hh mm ss.但是在这个方法里面,时间显示的永远是12小时制的. 如果需要显示24小时制的,把hh 换成kk即可.
Android Intent use a comprehensive summary of several Intent should be something peculiar to Android. You can specify the procedures Intent to perform actions (such as: view, edit, dial), and the program execution to the action when the required info
Transfer from East Fangshang Zhi Chen Dahai csdn blog: If it is from BroadcastReceiver start a new Activity, do not forget i.setFlags (Intent.FLAG_ACTIVITY_NEW_TASK); public class MyReceiver extends BroadcastReceiver ( public static final String acti
Transfer from East Fangshang Zhi Chen Dahai csdn blog: If it is from BroadcastReceiver start a new Activity, do not forget i.setFlags (Intent.FLAG_ACTIVITY_NEW_TASK); public class MyReceiver extends BroadcastReceiver ( public static final String acti
Intent, usage Intent should be something peculiar to Android. You can specify the procedures Intent to perform actions (such as: view, edit, dial), and the program execution to the action when the required information. Are well specified, simply call
Android Intent should be considered in specific things. You can specify the procedures Intent to perform actions (such as: view, edit, dial), and the program execution to the action of the necessary information. After all specified, just call startAc
First of all forgive me for writing the title of the article so long. In fact, I still find it too short because it can not be written out so I will not write. Because I really do not know how to define the title of this article may be called &Luanta
android is very simple to send text messages, In Mainfest.xml first need to add permissions: &uses-permission android:name=&android.permission.SEND_SMS&& &/ uses-permission& &uses-permission android:name=&android.permission.R
If it is from BroadcastReceiver start a new Activity, do not forget i.setFlags (Intent.FLAG_ACTIVITY_NEW_TASK); public class MyReceiver extends BroadcastReceiver { public static final String action = &acc&; public void onReceive (Context context
This is the original relentless snow, reprinted Please indicate the source: /blog/961576 Android Development Technology Exchange Group 86,686,524 (full) please add 120,059,404 Wrote Read the previous sections should be tutoria
online these days to write a variety of search code SMS monitoring service, and then returns a message with gps address and resolve gps address shown on the map a small program, but returned to the message displayed when the map a problem, my method
android's many functions are needed permission to operate, there are still many features we can direct the operation, just specify in the configuration file permissions on the line, but despite some indication of the authority, but still no permissio
1, Intent role Intent is to be implemented by the abstract description of the action, is generally used as a parameter, the Intent to assist with communication between the various components android. For example, call startActivity () to start an act
Android Today, we need to give talk about how to pass objects in the Intent, as I now know there are two ways, one is Bundle.putSerializable (Key, Object); the other is Bundle.putParcelable (Key, Object); Object Of course, these are certain condition
package irdc. import java.util.T import java.util.TimerT import android.app.A import android.os.B import android.os.H import android.os.M import android.telephony.SmsM import android.util.L public cl
Activity01.java package org.jzkangta.activity01; import android.app.A import android.content.I import android.os.B import android.view.V import android.view.View.OnClickL import android.widget.B public class Acti
There are three basic components of Android Activity, Service and BroadcastReceiver, they are dependent on Intent to start. This article is about the life cycle of Activity and Activity of Intent for use. Example has been used before the Activity, in
Copyright (C) , All Rights Reserved.
版权所有 闽ICP备号
processed in 0.051 (s). 9 q(s)}

我要回帖

更多关于 微信图标没有红点提示 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信