Professional Documents
Culture Documents
Understand how to create your own broadcast intent and broadcast receiver and ho
w to handle the given broadcast intent.
Description
In your application main screen, there are a text editor and two buttons. Once u
ser entered some string in the text editor then click the first button, a toast
message will be prompted with a message such as "Received your message <your typ
ed string>". If user clicks second button, another screen will be displayed with
registered/unregistered buttons.
1. Create an activity for your application main screen which including one text
editor and two buttons
2. Handle the first button event by creat your new broadcast intent with input f
rom the editor.
3. Modify your manifest file to declare your receiver with intentfilter for your
receiver intent
4. Create your broadcast receiver class and implement OnReceive() callback funct
ion to handle your receiver intent.
5. Use a toast message to indicate your receiver intent is handled.
6. Handle the second button to launch the second activity defined in http://www
.javacodegeeks.com/2012/09/android-broadcast-receiver.html