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