Android implements two page jumps

Source: Internet
Author: User

1. Implement conversion between two interfaces

In Android, the most common is to press the button and then jump to the second interface.

The key code is simple:

This is taking the BN2 button as an example, the current activity is mainactivity, jump to registration.

1Button BN2 =(Button) Findviewbyid (R.ID.BN2);2Bn2.setonclicklistener (NewOnclicklistener ()3         {4              Public voidOnClick (View v)5             {6Intent Intent2 =NewIntent (mainactivity. This,7Registration.class);8                 //activate the intent corresponding activity9 startactivity (intent2);Ten             } One});

To pull away again:

New Intent (mainactivity.  this,                          registration. class );                   // activate the intent corresponding activity                  StartActivity (Intent2);

2. There is also a more important point, which I have often overlooked.

To register a second activity in Androidmanifest.xml. Let's take resultactivity as an example:

< Activity            Android:name = "Com.example.personalmanager.ResultActivity"             android:label= "confirmation message">        </ Activity >

Android implements two page jumps

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.