Android Intents


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
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:

  1. Action   —-> the built-in action to be performed, such as ACTION_VIEW, ACTION_CALL,  ACTION_EDIT, ACTION_MAIN, … or user-created-activity
  2. 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);

startActivity (myActivity);

Example:

Display the phone dialer with the given number filled in.

Intent myActivity2 = new Intent(Intent.ACTION_DIAL, Uri.parse(“tel:5551234”));

startActivity(myActivity);

 

result:

 

here the file that you can download and practice at your computer:

http://www.ziddu.com/download/17646802/file.rar.html

2 thoughts on “Android Intents

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s