Andorid Miscellaneous pen in-depth understanding activity,intenthe intentfilter

Source: Internet
Author: User

1. Create, configure activity

1.Android offers a lot of activity classes

Accountauthenticatoractivity, Activity (tabactivity), listactivity (launcheractivity,preferenceactivity), aliasactivity,expandablelistactivity);

2. Once the activity is established, remember to configure it in the configuration file

2. Activate shutdown activity

There are boot methods with return and no return values, and closing methods for shutting yourself down and closing others

3. Use bundles to transfer data between activity
bundle.put*** (String key,*** data); Bundle.putserializable (String key,serializable data); (Serializable object)

The 4.Activity life cycle basically follows the callback mechanism, and the corresponding method is called when the activity enters a state.

5.Inent has component,action,category,data,type,extra,flag seven properties

1.Component property to receive a ComponentName object

2.intent.setcomponent (ComponentName object);

can also be simplified to intent intent = new Intent (... this,。。。. class);

SetClass method was also found after android3.0.

When a program starts a component with the component property of the intent, the component that is launched is rarely required to be configured with Intentfilter

Action,category and Intent-filter Configuration

In my opinion, the method of starting a component through Setaction and addcastegory is mostly used when invoking the activity of the system, which requires the Intent-filter configuration of the component to be launched in the configuration file.

Data,type Properties and Intent-filter configuration

The Data property is used to provide an action property to the action attribute, which receives a URI object, such as CONTENT://COM.ANDROID.CONTACTS/CONTACTS/1, the specified data type before the colon, and the data portion after the colon. The Type property is used to explicitly specify the kind or MIME type of the data specified by the DataSource property, and the Type property is generally valid when the intent does not specify an attribute

The extra property is used for data transfer Intent.putextras (bundles) between multiple activity.

Create a tab page using intent

Using the SetContent method of Tabhost.tabspec in Tabactivity, you can use the specified activity class as the tab page

  

Andorid Miscellaneous pen in-depth understanding activity,intenthe intentfilter

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.