try to write back … about somethings that are useful and helpful for myself or other users …. ^^
now I try to explain the use of intents in programming android. In this article will also be in a few source code examples of the use of intents in programming android.
intents are invoked using the following options:
- startActivity (intent) —-> launch an Activity
- sendBroadcast (intent) —–> sends an intent to any interested BroadcastReceiver components
- startServices (intent) —-> communicate with a background service
The main arguments of an intent are:
- Action —-> the built-in action to be performed, such as ACTION_VIEW, ACTION_CALL, ACTION_EDIT, ACTION_MAIN, … or user-created-activity
- Data —–> the primary data to operate on, such as phone number to be called (expressed as a Uri)
Typically an intent is called as follows :
Intent myActivity = new Intent(action, data);
Display the phone dialer with the given number filled in.
Intent myActivity2 = new Intent(Intent.ACTION_DIAL, Uri.parse(“tel:5551234”));
here the file that you can download and practice at your computer: