how to link multiple form in android eclipse?*Do i have to make multiple xml files in res/layout/main.xml and if this how to use them?*
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I’ll make a quick explanation for you at your level of understanding. You will want to follow the tutorial Houcine gave you, but to answer your question best I can:
First off: A form is a field that users input information into. Like a textbox, or a checkbox. You CAN put multiple forms on a single page. For example:
See, all sorts of forms!
But I think what you mean to ask is, how do I link to different layouts.
The answer to your second question is: Yes! Simply make a new xml file in your res>layout folder! Toss a
<?xml version="1.0" encoding="utf-8"?>at the top then have fun!If you want to link to that new layout, make a button or something in main.xml. in the .xml file of that button, add
android:onClick="doThis"(or whatever you want in the quotations) to the button.Now, make your second page (a new class) in the same directory as your main.java. Call it whatever you want. I’m going to call it Page2Activity.java.
Now, to switch between layouts easily as a beginner, I found this is the easiest way: Lets say our second page was page2.xml, add this piece of code into your main activity’s java file.
This should take you to the next class! Great huh? But we still need to use our page2.xml. You could use inflaters, (read up on those sometimes), but for beginner’s sake just put
after
In your Page2Activity
ONE MORE THING: You have to add your new activity to your manifest! Easy peasy. Open up your AndroidManifest.xml, and add
right after the first you see (which would be the main one)
Try it out!