package com.example.administrator.myapplication_reciver;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.widget.Toast;

/**
* Created by Administrator on 2018/1/1.
*/

public class Myreciver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {

String s=intent.getStringExtra("a")+intent.getStringExtra("a1");
Toast.makeText(context,s,Toast.LENGTH_LONG).show();

}
}

配置文件 AndroidManifest.xml <receiver android:name=".Myreciver">
<intent-filter>
<action android:name="reciver" />
</intent-filter>
</receiver>


3 Intent in =new Intent("reciver");
in.putExtra("a1","第二条是 你好啊,交个盆友吧!");
sendBroadcast(in);
send(v);

package com.example.administrator.myapplication_reciver;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.widget.Toast;

/**
* Created by Administrator on 2018/1/1.
*/

public class Myreciver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {

String s=intent.getStringExtra("a")+intent.getStringExtra("a1");
Toast.makeText(context,s,Toast.LENGTH_LONG).show();

}
}

配置文件 AndroidManifest.xml <receiver android:name=".Myreciver">
<intent-filter>
<action android:name="reciver" />
</intent-filter>
</receiver>


3 Intent in =new Intent("reciver");
in.putExtra("a1","第二条是 你好啊,交个盆友吧!");
sendBroadcast(in);
send(v);


安卓——BroadcastReceiver
package com.example.administrator.myapplication_reciver;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.widget.Toast;

/**
* Created by Administrator on 2018/1/1.
*/

public class Myreciver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {

String s=intent.getStringExtra("a")+intent.getStringExtra("a1");
Toast.makeText(context,s,Toast.LENGTH_LONG).show();

}
}

配置文件 AndroidManifest.xml <receiver android:name=".Myreciver">
<intent-filter>
<action android:name="reciver" />
</intent-filter>
</receiver>


3 Intent in =new Intent("reciver");
in.putExtra("a1","第二条是 你好啊,交个盆友吧!");
sendBroadcast(in);
send(v);

安卓——BroadcastReceiver的更多相关文章

  1. 安卓组件-BroadcastReceiver

    [转]http://emilyzhou.blog.51cto.com/3632647/685387 一.BroadcastReceiver的简介 用于异步接收广播Intent,广播Intent的发送是 ...

  2. Android中BroadcastReceiver的两种注册方式(静态和动态)详解

    今天我们一起来探讨下安卓中BroadcastReceiver组件以及详细分析下它的两种注册方式. BroadcastReceiver也就是"广播接收者"的意思,顾名思义,它就是用来 ...

  3. 手机APP开发:学JAVA转安卓APP开发是不是很容易?

    成都亿合云商小编为您分享:Android开发是以Java语言为基础的,Android 虽然使用Java 语言作为开发工具,但是在实际开发中发现,还是与Java SDK 有一些不同的地方.Android ...

  4. 安卓版App开发心得

    从2016年4月到6月主要做的工作是网站的开发,而6月到现在2016年8月初,主要做的工作是Android和IOS两种App的开发,又以Android为主. 将这段时间的Android开发心得记录如下 ...

  5. 安卓App流量统计

    http://keepcleargas.bitbucket.org/2013/10/12/android-App-Traffic.html 安卓App流量统计 12 OCT 2013 android流 ...

  6. 安卓Android面试题大全

    56个问题都是经常用到的,可以深入研究下,也是必须掌握的开发必备知识. 安卓Android面试题汇总 搜集了一些Android面试题目,供将要面试或者正在面试的朋友参考. 1, 谈谈你对Activit ...

  7. 安卓第十一天笔记-Intent与inter-filter配置

    安卓第十一天笔记-Intent与inter-filter配置 Intent与inter-filter配置 1.Intent对象简述 Android应用中有包含三种重要组件:Activity,Servi ...

  8. 安卓任意两个或多个Fragment之间的交互与刷新界面

    平时项目中遇到一个问题:在子fragment中刷新父fragment的界面,通俗的说也就是在任何一个fragment中来刷新另一个fragment.大家都知道activity和fragment之间的交 ...

  9. 安卓蓝牙技术Bluetooth使用流程(Bluetooth详解)

    一:蓝牙设备之间的通讯首要包含了四个进程 设置蓝牙设备 寻觅局域网内也许或许匹配的设备 衔接设备 设备之间的数据传输 二:详细编程完结 1. 发动蓝牙功用 首要经过调用静态办法getDefaultAd ...

随机推荐

  1. 论文笔记之:Heterogeneous Face Attribute Estimation: A Deep Multi-Task Learning Approach

    Heterogeneous Face Attribute Estimation: A Deep Multi-Task Learning Approach  2017.11.28 Introductio ...

  2. cmd设置环境变量

    方法,仅本次生效 set path=%path%;[新路径]方法,永久生效 setx path "%path%;[新路径]"方法,永久生效 wmic ENVIRONMENT cre ...

  3. hdu 6053 TrickGCD 筛法

    TrickGCD Time Limit: 5000/2500 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others) Probl ...

  4. GYM 101064 2016 USP Try-outs G. The Declaration of Independence 主席树

    G. The Declaration of Independence time limit per test 1 second memory limit per test 256 megabytes ...

  5. Spring Security 中的加密BCryptPasswordEncoder

    // // Source code recreated from a .class file by IntelliJ IDEA // (powered by Fernflower decompiler ...

  6. jdbcTemplate 后台接口中的分页

    Springboot+jdbcTemplate  对查询结果列表做分页, 之前开发的小项目,数据逐渐增多,每次返回所有的查询结果,耗费性能和时间 想到做分页. 于是从简单的分页做起. jdbcTemp ...

  7. jfinal集成cas单点认证实践

    本示例jfinal集成cas单点认证,采用获取到登录用户session信息后,在本地站点备份一份session信息,主要做以下几个步骤: 1.站点引入响应jar包: 2.在web.xml中配置对应过滤 ...

  8. 关于编码:Unicode/UTF-8/UTF-16/UTF-32

    关于编码,绕不开下面这些概念 ①Unicode/UTF-8/UTF-16/UTF-32 ②大小端字节序(big-endian/little-endian) ③BOM(Byte Order Mark) ...

  9. UnityShader中的语义相关

    语义简介:实际上就是一个表达参数含义的字符串. 应用阶段到顶点着色器时用常用的语义如下: POSITION:模型空间中的顶点坐标 NORMAL:模型空间中的法线方向 TANGENT:模型空间中的切线方 ...

  10. 第 3 章 镜像 - 017 - RUN vs CMD vs ENTRYPOINT

    RUN.CMD 和 ENTRYPOINT 这三个 Dockerfile 指令看上去很类似,很容易混淆. 简单的说: RUN 执行命令并创建新的镜像层,RUN 经常用于安装软件包. CMD 设置容器启动 ...