views:

161

answers:

1

Hi,

I am having layout which I want to render on to different sizes of mobile (like WVGA854). Resource structure is like

res\layout\main.xml res\layout-large\main.xml

By default it is taking layout main.xml file itself of layout. Its not pointing to layout-large\main.xml

its throwing exception:Activity can not start resource not found

So can any one guide me how can I acheive this and how to support mutiple screens with different layouts like large,small and default along with images specified in respective dip folders.

Thanks in advance

Regards: Jayanth

A: 

its throwing exception:Activity can not start resource not found

If your files are what you say they are, you should not get this error for main.xml. You have a main.xml in the res/layout/ directory, so that will be used if nothing better is found. I suspect your error may be related to some other resource.

Here are some sample projects from one of my books that demonstrate using multiple screen sizes and densities.

CommonsWare
I have tried your code(project) also. Same thing I am getting exception resource not found.I tried your code by deleting main.xml from ur layout folder and exceuted in differnet resolution emulator. So I get Resource not found exception.
I tried executing your project in different resolutions of simulator. But in none of the simulators its taking layout-large-land\main.xml.Do I need to do any configurations or settings ..... and i have included all the attributes in mainifest file.
There is no large emulator by default. The WVGA800/WVGA854 get high density by default, and so they are size medium. You need to modify some settings for the AVD, setting `hw.lcd.density` to 160 (medium) to get a large screen. http://developer.android.com/guide/developing/tools/avd.html#hardwareopts
CommonsWare
I have as per comments u have given. This is fine. What exactly I need is ,suppose there is login screen.I have background image for login with 320*480 resolution. And using nine patch, I am using the same image(so that only borders get strech) My actual background of text fields and login button will not be streched.In WVGA800/845 I am able to get nine patch image from hdpi resource, problem is my control getting distructed, and also the position getting disturbed. So for this I want to define the diff. layouts by specifying appropriate positions acc. to my image.So how to achevie this issue.