File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Android and the fly likes how to use main xml file in layout-land folder ? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Mobile » Android
Reply Bookmark "how to use main xml file in layout-land folder ?" Watch "how to use main xml file in layout-land folder ?" New topic
Author

how to use main xml file in layout-land folder ?

sameera liyanage
Ranch Hand

Joined: Nov 25, 2008
Posts: 597
normally we put main xml file in res/layout folder.
I have a main file in res/layout-land folder.I need to use that file as main xml.so which code need to change ?
i have attached a screenshot also below.

[Thumb - main.jpg]
 Filename main.jpg [Disk] Download
 Description
 Filesize 274 Kbytes
 Downloaded:  37 time(s)

Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 4875

You can name the files in res/layout anything that you like, for example: altscreen.xml Then in R.java you will get constant within the "layout" with the XML file's name, for example:



Then use that in your activity's onCreate method:



JBoss In Action
sameera liyanage
Ranch Hand

Joined: Nov 25, 2008
Posts: 597
i have alrady created a main xml in res/layout-land folder.but there is no any specific variable created for that in R java class.
below is R java class

below is my screenshot .look there is main xml file located in res/layout folder
[Thumb - lay.jpg]
 Filename lay.jpg [Disk] Download
 Description
 Filesize 294 Kbytes
 Downloaded:  27 time(s)

Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 4875

You need to regenerate the R.java file. One way to do this is to rebuild the project.
Mayu Mayooresan
Ranch Hand

Joined: Mar 12, 2011
Posts: 35

You are trying to refer the layout-land but your code refers R.layout.main

so the layout shown will be the main.xml file under layout folder.

btw avoid using - in folder file names, it'll create compilation error most of the time.
 
 
subject: how to use main xml file in layout-land folder ?
 
Threads others viewed
Android User Interface Development - Is it easier/ harder than Blackberry UI development?
Portrait/Landscape issue
Advice on the use of compound resource qualifiers
Creating a new Bitmap in xml by cropping an existing image
Splash Screen

cast iron skillet 49er

more from paul wheaton's glorious empire of web junk: cast iron skillet diatomaceous earth rocket mass heater sepp holzer raised garden beds raising chickens lawn care CFL flea control missoula heat permaculture