Adding a new XML file to R java class

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

Adding a new XML file to R java class

Postby jmejiaa » Mon Nov 17, 2008 12:47 am

Hello.

I have my main.xml and I want to create another .xml to be used by an Activity I am creating, I am trying to replicate what my existing code is doing but I cannot seem to be able to get Eclipse or the sdk to pick up this xml file and recognize it as part of the app.

Any suggestions?
jmejiaa
Junior Developer
Junior Developer
 
Posts: 22
Joined: Sat Nov 15, 2008 6:36 pm

Top

Postby jmejiaa » Mon Nov 17, 2008 2:31 am

This has to be very basic but somehow I cannot find it in the Google documentation or searching this forum.
jmejiaa
Junior Developer
Junior Developer
 
Posts: 22
Joined: Sat Nov 15, 2008 6:36 pm

Postby MrSnowflake » Mon Nov 17, 2008 11:38 am

Just create another valid xml layout file in the res/layout directory and eclipse updates it automatically.

NOTE: For eclipse to update the R file, all resources should be valid!
User avatar
MrSnowflake
Moderator
Moderator
 
Posts: 1439
Joined: Sat Feb 16, 2008 3:11 pm
Location: Flanders, Belgium

Postby KanedaSyndrome » Mon Nov 17, 2008 3:29 pm

yeh what snow said, just right click the layout folder, choose new, newfile and name it something.xml and it will be updated. You can then have another layout file in this way.
KanedaSyndrome
Developer
Developer
 
Posts: 41
Joined: Tue Nov 11, 2008 3:32 pm

Postby rmanromga » Tue Nov 25, 2008 3:50 am

Also, after creating your new xml file, if you want to have the "Layout" tab appear at the bottom of your eclipse editor, right click on the new file then click on 'Open With', then click 'Other', then chose 'Android Layout Editor'. I don't how it is for other people, but I'm using Ubuntu and eclipse and when I create a new xml file, in an androd layout project, it is not automatically recognixed as an android layout so eclipse edits it as a regular xml file. This drove me nuts before I realized what was wrong.... I really like looking at the actual screen layout when designing my screens on that layout tab.......


cheers,
--D
rmanromga
Developer
Developer
 
Posts: 43
Joined: Thu Dec 20, 2007 6:21 am
Location: Baltimore, MD USA

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: Majestic-12 [Bot], Yahoo [Bot] and 3 guests