How many AVDs do I need? - android

How many AVDs do I need to properly test all layouts? I tried using the stock Google nexus devices but many of the different layouts were tested on the same device. What devices should I use so each layout has an appropriate device? Also, what is the best way to allow flexibility for sp adjustments?

I use:
an avd for the minimum screen I support ~3.5" (320x240 ldpi or 340x480 mdpi)
avds for the most common configuration ~4.5" (480x800 hdpi and 720x1280 xhdpi)
an avd for the maximum configuration ~6" (1920x1080)
include medium and large tablets in the case I also support tablets.

You need exactly four AVD to support all kinds of devices.
You have to set the different screen size for multiple devices esp. hdpi,mdpi,xhdpi and ldpi.
Refer here.You have to create a separate folder for all devices.
Supporting Multiple Screens

Read AndroidDevelopers Training and Guide . You must have at least one AVD for each density type (hdpi,xhdpi etc.). and each with different resolution and physical size.
About the sp- you should define them in dimens.xml file in each values folder(According device width-height).

Related

Drawable folder for 4:3 devices?

I'm developing a game for tablet devices. Currently I'm using drawable-sw600dp and drawable-sw720dp folders to place graphics for 7 and 10 inch devices respectively. But the problem is that the graphics are made according to traditional 16:10 devices which do not scale well on 4:3 devices like nexus 9. I've tried using drawable-sw720dp-notlong, drawable-2048x1536 and a number of different qualifier. Nothing works. If anyone could tell me what folder will work for 4:3 devices without affecting other devices that would be great.
values-sw720dp-notlong
worked very well for me on Nexus-9 (you have typo in word "notlong"), it was prioritized before
values-sw720dp
If it still doesn't work, please check if you don't have other qualifiers with higher priority.
Configuration qualifiers, in order of precedence:
http://developer.android.com/guide/topics/resources/providing-resources.html#table2

Android Phone and Tablet UI

I have made one app which is working fine for both Tablets and Phones. But as we know we should have a different layout for tablets( such as bigger font and images etc).
My question is how to provide the layouts such that they are only picked by tablets and not phones.
Example: If i provide xhdpi or hdpi layout thinking of these as tablet then it may be picked by some device also which is using this same configuration.
So how to be sure that a current device is tablet or phone and provide a specific layout for it?
My question is how to provide the layouts such that they are only picked by tablets and not phones.
Either use the classic screen size buckets (e.g., res/layout-large/) or come up with your own buckets using -swNNNdp (e.g., res/layout-sw600dp/ for resources to be used on devices whose shortest width is 600dp or higher).
This is explained in the documentation here, here, here, and perhaps a few other spots as well.
Example: If i provide xhdpi or hdpi layout thinking of these as tablet then it may be picked by some device also which is using this same configuration.
-xhdpi and -hdpi are screen densities and have nothing directly to do with screen size.

Designing layouts for phones and tablets

Okay i am familiar with this site and what it says
http://developer.android.com/guide/practices/screens_support.html
But im still having a problem.
I am designing layouts for phones and tablets from gingerbread to jelly bean.
I had started with a basic layout folder and designed everything for a galaxy nexus phone. now im going back and adding tablets. one question here is should i use layout-xlarge/layout-large or layout-sw600dp/layout-sw720dp? im guessing the smallest width is what i should be using.
But thats not the issue.
This issue is im trying to do that layous for Galaxy Nexus (720x1280) and Nexus S (480x800) These are much different yet eclipse doesn't seem to let me differentiate.
So i just want to be clear on what i should be doing to do this right. is this what i should have to cover the devices i want to?
layout-hdpi
layout-xhdpi
layout-sw600dp (instead of layout-large)
layout-sw720dp (instead of layout-xlarge)
will doing those layout-hdpi and layout-xhdpi separate the layouts for a Nexus S and Galaxy Nexus?
First, the layout-sw are based on dp, Density-independent pixels, rather than pixels. You can think of dp as 'actual size' pixels i.e., 1dp is the same physical size no matter what device is being used.
Therefore the Galaxy Nexus, which has a 720x1280 pixel screen is only 360x640 dp resolution and there is no overlap between a phone and the higher sw600+ folders.
The large/xlarge buckets will continue to work on all tablets, but if you need finer grained support or alright only using tablet layouts on Android 3.2+ devices, then you only need the sw--dp folders. You can also use both without copy/pasting your XML by using a reference file, as detailed in the below blog post.
More details on how to support multiple screens can be found in Supporting Multiple Screens guide and some of the reasoning behind why you'd want to use the new sw---dp buckets can be found on the Android Developers blog post announcing the feature.
Just use layout-large and layout-xlarge. When you're developing the layouts and want to know what it looks like on a certain device, just change the view and it will pull the appropriate XML from the correct folder.

I am confused with drawable-hdpi and drawable-mdpi

i am attempting to get my android app to work on both phone type devices and tablets. for the layouts i have layout-normal and layout-large and i place my xml files inside each and it seems to select the correct one for each device (layout-normal for phones and layout-large for tablets).
however the problem arises for the drawable folders. i have drawable-hdpi, drawable-mdpi and drawable-ldpi. the tablet is taking its images from the drawable-mdpi, and the phone is taking its images from the drawable-hdpi. from the reading i have been doing this seems to be backwards??? this seems to happen on both the emulator and real devices, could i be doing something wrong? am i mixing something up?
Clayton,
drawable-hdpi and drawable-mdpi is not related to the size of the screen itself, but to the resolution of the display.
It's probably easy to think in terms of the iPhone 3GS and 4 for this (bear with me please). The 4 has retina display, hence a much higher resolution. Using the same sprites you'd use with the 3GS would result in a blurry display.
Android phones are, if anything, much more diverse in terms of screen options.
If you want to be able to aim different layouts at different resolutions, please try putting the layouts into /layout-xlarge, /layout-large, etc...
You can find more here:
http://developer.android.com/guide/practices/screens_support.html
There are some changes that you can see for Android 3.2 and above:
Beginning with Android 3.2 (API level 13), the above size groups are
deprecated and you should instead use the swdp configuration
qualifier to define the smallest available width required by your
layout resources. For example, if your multi-pane tablet layout
requires at least 600dp of screen width, you should place it in
layout-sw600dp/. Using the new techniques for declaring layout
resources is discussed further in the section about Declaring Tablet
Layouts for Android 3.2.
ldpi, mdpi, and hdpi refer to pixel density, not screen size.
The accepted answer does not address a serious problem: if you have many drawables, you end up with an unnecessarily big apk file because of resource duplicating. The only solution for that is the resource alias option described here:
http://blog.evendanan.net/2011/03/Android-resources-and-device-fragmentation
Edit: I just beheld that OP didn't realize that most phones have hdpi density, while most tablets have mdpi density. At the same time the tablets mostly have higher resolution. Hence Android will use smaller pictures for higher resolution.
You can overcome this only by using vector images or using the methods described in the accepted answer and in my answer.
drawable-hdpi - application use this drawable images when the device has high pixel density
drawable-mdpi - application use this drawable images when the device has medium pixel density
drawable-ldpi.-application use this drawable images when the device has low pixel density

Which layout will use a 10,1" 1024x600 tablet?

I want to make sure that devices with 10,1" and 1024x600 under 2.1/2.2(e.g. Archos 101) are using the correct layout.
Are they large and ldpi?
Also, how can I simulate them using the android emulator?
In the end, the choices of screen size and screen density are up to the manufacturer. Hence, nobody here can answer you definitively.
A 10.1" diagonal screen should be large and probably should be ldpi, though it is possible it will be declared mdpi based upon the apparent density given the distance one would typically hold a 10.1" tablet from one's face.
Bear in mind that ARCHOS' devices do not ship with the Android Market AFAIK, and hence do not necessarily pass the various compatibility tests. As a result, ARCHOS could do all sorts of stuff that would be unexpected.
Also, how can I simulate them using the android emulator?
The Android SDK is not well-suited for testing a 10.1" LCD at this time. I would expect better instructions and support for such sizes in Android 3.0.
For now, set the resolution and density for the AVD when you create it. In this case, you would want to specify 120dpi (ldpi) for the density. Android should put it in the large screen size bucket for you, given those values. Leastways, that basic approach works for getting large WVGA devices.

Categories

Resources