(Android review) display intent activation and implicit intent Activation

Source: Internet
Author: User

(Android review) explicit and implicit intent Activation

I. Basic knowledge points

1,

Label attribute: the title of an Acivity.


2. Do not introduce the R file into an error.


3. intent. setClass (this, Main2Activity. class );
First parameter: Context
Second parameter: the bytecode file of the component to be activated


4. Explicit activation (explicitly specifying the component to be activated)
1) intent. setClass (this, Main2Activity. class );


2) intent. setClassName (this, "com. njupt. multiactivity. Main2Activity ");
Second parameter: The full Class Name of the component to be opened


3) intent. setClassName (getPackageName (), "com. njupt. multiactivity. Main2Activity ");
GetPackageName (): Get AndroidManefest Value of the package attribute under the node


4) intent. setComponent (new ComponentName (this, Main2Activity. class ));


5) Intent intent = new Intent (this, Main2Activity. class );


5, Android: onClick = "open"/>
Multiple controls can stimulate the same event handler function.


6. Implicit intent activation (this is what we did before activating the browser)
1)
Related Article

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.