Android from ignorance to knowledge-No. 7 and androidno.7
The ip address dialer previously used broadcast events provided by the system to listen for outbound calls. In some cases, we need to set broadcast events to meet specific needs. OK. Today, we use a status monitoring module to send alarm messages to a 3G module.
First, define a 3G module to receive specific broadcasts:
<TextView android: layout_width = "wrap_content" android: layout_height = "wrap_content" android: layout_centerHorizontal = "true" android: layout_centerVertical = "true" android: text = "I Am a 3G module ~~~~ "/>
Then set its custom broadcast events:
<receiver android:name=".MyBro"> <intent-filter> <action android:name="com.heng.lh"/> </intent-filter></receiver>
HereCom. heng. lh is a broadcast event defined by us to receive signals from specific channels.
Then let's "sp" it. If a custom broadcast is sent, a prompt will be sent to the user.
Public void onReceive (Context context, Intent intent) {Toast. makeText (context, "a broadcast event is detected", 1). show ();}
The module that receives the broadcast is ready, and then the module that sends the broadcast is set. A button is required on the main interface to send the alarm information to the 3G module:
<Button android: onClick = "click" android: layout_width = "wrap_content" android: layout_height = "wrap_content" android: layout_centerHorizontal = "true" android: layout_centerVertical = "true" android: text = "send information to 3G module"/>
Let's write down this click event, new out an intent, and then set its action, that is, the custom "com. heng. then, send the message with sendBroadcast.
Public void click (View view) {Intent intent = new Intent (); intent. setAction ("com. heng. lh "); // send the alarm information to the 3G module sendBroadcast (intent );}
In this way, the 3G module receives a broadcast message, and a simple custom broadcast event is created.
Answer: from ignorance to knowledge,
B
From ignorance to knowledge, it means not understanding, or being immature to maturity.
From ignorance to ignorance, you can accept some nonsense words with patience.