Intent four important attributes

Source: Internet
Author: User

Intent as a link between the activity, its role is not only limited to simple data transmission. Through its own properties, it is easy to complete a lot of more complex operations. For example, call the dialing function directly, automatically call the appropriate program to open different types of files and so on. And so on, you can do this by setting the intent property.

Intent mainly has the following four important attributes, respectively:

The value of the Action:action property is a string that represents a series of commonly used actions that have been defined in the system. Set through the Setaction () method or in the manifest file androidmanifest.xml. Defaults to: Default.

Data:data is typically the operation data defined by the URI format. For example: tel://. Set by the SetData () method.

The Category:category property is used to specify the environment in which the current action (action) is executed. Set through the Addcategory () method or in the manifest file androidmanifest.xml. The default is: Category_default.

The Extras:extras property is primarily used to pass the additional data required by the target component. Set by the Putextras () method.

The common values for each of the four properties are as follows:

Action:

Action_main:android application's entrance, each Android app must and can contain only one action declaration of this type.

Action_view: The system displays data through the registered corresponding application according to the different data types.

Action_edit: The system edits the data according to the different data types through the registered corresponding application.

Action_dial: Opens the system's default dialer, and automatically enters this number in the dialer if the phone number is set in data.

Action_call: Direct call to the number in data.

Action_answer: Answer the call.

Action_send: The user specifies the sending method for the data send operation.

Action_sendto: According to different data types, the system sends the data via the registered correspondence application.

The action_boot_completed:android system emits a broadcast with this action (broadcast) after it has been started.

A broadcast (broadcast) with this action is issued after the time of the action_time_changed:android system has changed.

A broadcast (broadcast) with this action is issued after the action_package_added:android system has installed a new application.

A broadcast (broadcast) with this action is issued after a change in the existing application in the Action_package_changed:android system, such as applying an update operation.

Action_package_removed: A broadcast (broadcast) with this action is issued after uninstalling an existing application of the Android system.

Category:

The default mode of execution in the category_default:android system is performed according to the execution of normal activity.

Category_home: Sets the component as the HOME Activity.

Category_preference: Set the component to PREFERENCE.

Category_launcher: Sets the component to be the highest priority activity in the current application launcher, typically used with ingress Action_main.

Category_browsable: Setting this component can be started using the browser.

Category_gadget: Setting this component can be embedded into another activity.

Extras:

EXTRA_BCC: An array of strings that hold the message's secret address.

EXTRA_CC: An array of strings that hold the e-mail cc addresses.

Extra_email: An array of strings that hold the e-mail address.

Extra_subject: Holds the message subject string.

Extra_text: Store the contents of the message.

Extra_key_event: The button that triggers intent is stored as a KeyEvent object.

Extra_phone_number: The phone number when the call to Action_call is stored.

Data:

TEL://: The number data format followed by the phone number.

MAILTO://: The message data format, followed by the mail recipient address.

SMSTO://: Short data format followed by SMS receiving number.

CONTENT://: The content data format, followed by what needs to be read.

file://: File data format followed by file path.

Market://search?q=pname:pkgname: Market data format, search for apps with the package name Pkgname in Google markets.

Geo://latitude, Longitude: The latitude and Longitude data format that displays the location specified by latitude and longitude on the map.

Intent four important attributes

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.