Intent Composition

Description

An intent has fours parts:

  • name,
  • data
  • type
  • category

Note

In Android, intents usually come in pairs: action and data.

The action describes what is to be performed, such as editing an item, viewing the content of an item, and so on.

The data specifies what is affected, such as a person in the Contacts database.

The data is specified as an Uri object.

Some examples of action are as follows:

  • ACTION_VIEW
  • ACTION_DIAL
  • ACTION_PICK

Some examples of data include the following:

  • www.java2s.com
  • tel:+9991231234
  • geo:37.999900,-122.999970
  • content://contacts

The action and data pair describes the operation to be performed.
For example, to dial a phone number, you would use the pair ACTION_DIAL/tel:+999234567.

To display a list of contacts stored in your phone, you use the pair ACTION_VIEW/content://contacts.

To pick a contact from the list of contacts, you use the pair ACTION_PICK/content://contacts.





















Home »
  Android »
    Android Basics »




Hello Android
Resources
Activity
Calendar
Camera
Contact
Content Provider
Database
Hardware
Intent
Location
Media
Network
Notification
Preference
Sensor
Service
SMS