Getting Started with Android-(c) Jump code

Source: Internet
Author: User

A project has a lot of Activity, but how do you jump from one interface to another?

I searched the internet for a way to:

Assume that the current page activity name is a, to jump to the name of B

Write an OnClick method in a with intent class links A and B

 Public voidonClick01 (View v) {//TODO auto-generated Method StubIntent Intent =NewIntent (); Intent.setclass (mainactivity. This, Jggmainactivity.class );     StartActivity (Intent); }     Public voidonClick02 (View v) {//TODO auto-generated Method StubIntent Intent =NewIntent (); Intent.setclass (mainactivity. This, Zhu_cemainactivity.class );     StartActivity (Intent); }

This time, two click events are created, the A event name is Mainactivity, and the B event names are jggmainactivity and zhu_cemainactivity, respectively.

Here's the point.

I did it, the compilation passed, but when I clicked on the button it didn't happen to jump, what's the reason? Later only to realize that the modification of the Java file is not possible, you need to add the OnClick property to the button in the layout file

   android:onclick= "OnClick01"
android:onclick= "OnClick02"

Getting Started with Android-(c) Jump code

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.