Android开发——Broadcast广播
今天来讲一下广播的使用,广播也是在app内部传播消息的用处,有广播发送方也有广播接收方。 具体看代码来说明广播的使用。 1.发送广播 写一个页面来发送广播,具体看代码的注释 (1)页面布局文件 <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent" android:padding="15dp" tools:context=".broadcast.BroadActivity2"> <Button 按钮用来发送广播 android:id="@+id/click" android:layout_width="match_parent" android:layout_height="wrap_content" android