More than one xml in layouts?

Put problem concerning Views, Layouts and other XML-Resources (like AndroidManifest) here.

More than one xml in layouts?

Postby TRDanny » Tue Jul 21, 2009 7:50 pm

Hi, I have main.xml, but I think I might need another xml file to display another page. How do I do that?

I have a buttons on my main.xml. When the buttons are clicked, I used intents to direct it to a different page but I need to use xml layouts to correctly show my page there.

Thanks in advance.
TRDanny
Freshman
Freshman
 
Posts: 7
Joined: Mon Jul 13, 2009 3:07 pm

Top

Postby arams » Wed Jul 22, 2009 6:06 am

I dont know the correct method...

copy main.xml and paste it in res/layout
(Rename the file)
arams
Experienced Developer
Experienced Developer
 
Posts: 89
Joined: Fri May 08, 2009 7:45 am

Postby virtual » Wed Jul 22, 2009 7:55 am

Hi,
In your case for every button there will be a new Activity and every activity has it's own layout xmy(view).
Enjoy :)
Regards,
Virtual
virtual
Developer
Developer
 
Posts: 26
Joined: Tue Mar 24, 2009 11:20 am

Postby TheChosen » Wed Jul 22, 2009 4:06 pm

Yes, the answer is quite simple. By the click on a button you send an Intent which opens another Activity. In the onCreate()-method of this Activity you call setContentView(R.layout.filename);
TheChosen
Experienced Developer
Experienced Developer
 
Posts: 62
Joined: Tue Jan 06, 2009 7:18 pm
Location: Germany

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: Exabot [Bot] and 3 guests