Anyone who has used VB and VC # knows that it is easy to switch the window (Interface) in VB or VC #.
For example, in VB and C:
There are fom1, form2, and form3, if you want to switch.
Form1.show ()
Form2.show ()
It was quite simple. At that time, in Android, it was very "difficult" to do so. You have to worry about it.
Based on my previous programming experience, I provide a simple solution here.
Step 1 create a project, such as "uitest ".
Step 2: Transform the code file of this project
Open the "uitestactivity. Java" file. Delete the code.
Delete the setcontentview line. In this case, the main. XML interface will not be automatically used by the program.
Step 3 package and combine the interface
One XML interface file works with one Java File
First, we will "Wrap" the layout Interface main. xml"
After packaging, we will return to the uitestactivity. Java file.
Modify
See no, is it like VB or VC. Haha
Step 4 Create an XML interface (phone. XML)
After the interface is laid out, create a class file frmphone. Java
After this step is completed, we will return to the main interface and add a [button] in it]
After the button control is added, go to frmmain. Java and bind the event to this button.
Run the test now. Click [open frmphone] on the main interface to open the phone interface.
After clicking, the program jumps to the phone. XML interface.
Now bind the return button with another event to return to the main interface.
Test to see if you can jump directly on the interface. And similar to VB or VC #.