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

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.

Related

Android Galaxy S4 uses values-large?

Problem:
I am testing my app using the Eclipse/ADT bundle. On an AVD created to emulate the Galaxy S4 (a device defined as being "normal" in size) the OS is selecting the XML files from the values-large folder.
The Android operating system is ignoring all other values folders I have defined in an attempt to differentiate the S4 from tablets.
Given the following folders, it selects the values-large folder for the S4:
values-large
values-sw720dp
values
values-normal-hdpi
values-normal-mdpi
values-normal-xhdpi
values-normal-xxhdpi
values-normal
The problem is that I have Master/Detail (ListFragment/Detail-Fragment) two-fragment display that only displays correctly on large screens (tablets). It does not display correctly on the S4, because of the device's size. On a device smaller than 6" wide, the icons end up getting displayed on top of the text, instead of to the right of the text. The only difference is with the S4 in landscape orientation.
The S4 is the ONLY normal sized device that can show the two-pane layout in landscape orientation. The Nexus 4 and others cannot. In landscape the extra density of the S4 is what makes it work.
I also don't want the S4 to use the dimens.xml file that is in the values-large directory.
Questions:
Is this normal/expected behavior? Does the OS classify the S4 as a "large" device? The OS has ignored every other folder name I have tried to use to target the S4. So, it prefers the pre 3.2 names over the newer ones.
In other words, when I attempt to use the newer folder names, like values-sw720dp, the OS still chooses the large folder.
I have two AVDs. One I created to match the specs of the S4. The other is the Sony Xperia Z1, that has the same specs and is available when you install the Sony SDK. Both AVDs are setup with size=normal. I have checked each to makes certain there is no mistake in their setup.
Thanks.
EDIT
I have a new LG G2, which is similar to the S4 in size and density. It does NOT use the values-large directory. I think it is using values-normal-xxhdpi, but need to run more tests (changing dimension values in the dimens.xml) to see what directory it is choosing.
values-large etc are deprecated with android 3.2 (?). It was replaced with things like values-sw720dp and there is basically not a single device out there running android 3.0 or 3.1. Any device running android 2.x is most likely a medium sized phone.
This means, there is no need of using this old qualifiers.
values-sw720dp means, smallest width = 720dp I doubt, your S4 is that wide.
You should use a qualifier like values-w720dp, which means width = 720dp where width depends on your current orientation.
It's way better than relaying on port or land combination because it shows the two pane layout for large displays having 720dp width in portrait orientation too.
Master/Detail two-pane layout for large screens (any orientation)
That seems fine. The implication is that you will use this for -xlarge as well as -large.
and medium screens with high dpi in landscape orientation
First, I do not know what "medium screens" are, as that term is not used in Android development.
Second, I have no idea why you think this would be appropriate. Screen density should not impact the decision of whether to show one or two panes. I would be interested to know applications, written by experts, you see taking this approach.
At first I thought it was the second folder (sw720dp) causing the problem
Note that you have not stated what the problem is.
The Sony Xperia Z1 AVD
I am not aware that SONY distributes emulator images for their devices.
does the same thing as the S4 AVD
I am not aware that Samsung distributes emulator images for their devices.
Is there a values folder I can use to make the Galaxy S4 not choose Master/Detail at all, but still allow tablets to use it?
Ignoring your "medium screens with high dpi in landscape orientation", use -large or -xlarge for tablets. The Samsung Galaxy S4 will not use -large or -xlarge resources, as it is a -normal device. This was confirmed using both the GT-I9500 and the SGH-I337 versions of this particular model.
Is there a way I can make it use Master/Detail for the S4 only when in landscape?
You can use -normal-land to identify -normal devices in the -land orientation. Note that screen size (-normal) is a bit of a fuzzy match, in that Android considers that valid for devices in that size class or larger. Hence, -normal-land would be used by -large-land and -xlarge-land devices as well, in the absence of better matches.
(Note that density qualifiers are even fuzzier -- -mdpi will be used for any device density, in the absence of a better match, as density qualifiers are designed to be used only on drawable directories, where Android can apply resampling algorithms. Using density qualifiers on anything other than drawables and maybe dimension resources is a code smell.)
Personally, I would not use a dual-pane strategy for -normal-land devices, as -normal goes all the way down to 3" diagonal.
This is all in the Eclipse/ADT bundle using the emulator.
My guess is that this is where your problems are coming in.
Unless you downloaded something from a device manufacturer (e.g., Amazon with their emulator images for the Kindle Fire series), NEVER say that you have a "Sony Xperia Z1 AVD" or a "S4 AVD". You are lying to us and, worse, you are lying to yourself. At best, you have an emulator image that you think that you have configured to match the specifications of those devices. However:
That assumes you got the configuration correct
That assumes that the device manufacturer has not changed the behavior of their device at the firmware level
That assumes there are no emulator bugs
You are certainly welcome to say that you are testing things on -normal -hdpi emulators, or the like, as those are things that you directly control via the Device Definitions tab of the AVD Manager.
After reading your comments, I noticed you said you said the Galaxy S4 screen size you defined was 4.9"? All the specs I've seen say it's 5" which will actually change the size in Device definitions from "normal" to "large" once you correctly set the S4 and Nexus 5 to 5".
Edit the Galaxy S4 emulator's definitions to 5" so you have the right screen size, it will auto-change the size to large, so you will need to decide if you need to switch it to normal then go from there. Also, for those wondering, once that avd starts, it does say that it's pulling from the sw480dp folder, so in your case, you would need a new folder:
values-sw480dp or to eliminate large devices in this bucket, values-normal-sw480dp

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.

how can i develop application for all android devices ? what setting can i put on simulator that work on most devices?

What simulator resolution i should keep when developing application for Samsung galaxy s2 and galaxy s3 ?
What i found that samsung galaxy s2 has 480x800 resolution and s3 has 1280x720 resolution so what i have understood up till now that I should ask my graphics designer to provide me hdpi graphics that contain 480x800 background images and to implement same background image in galaxy s3 mobile, I will use image of size 1280x720 and put in xhdpi folder so that it can work on s3.
The background image is something which covers whole available area for mobile app. so am i right ??
You will need to create several emulators or get various devices.
There are some pretty important ones, so generally you need to make sure you have:
ldpi, mdpi, hdpi, xhdpi
and
small, medium, large, xlarge
Some people choose to exclude certain sizes (like small and ldpi) but htat's up to you,
if you go with some or all of the following, it should be a good start:
480x320 (SE Mini 10), 480x800 (GS2, Desire, etc), 1280x720 (GS3, Galaxy Nexus etc), 1280x800 (Note, Xoom, various other tablets)
HTC ChaCha (because it's landscape default)
You need to make sure you create resources in the relevant folders for each density, usually, I tend to ignore ldpi and just put resources in:
mdpi,hdpi and xhdpi (mdpi will be scaled down for ldpi devices,
automatically)
You may also need to create various portrait and landscape layouts in different sizes.
Reading this page provides most of the necessary information:
http://developer.android.com/guide/practices/screens_support.html
This page also contains important information regarding size distribution and popularity that is constantly up to date:
Android Stats
One thing that Android does for you is that it manages resolution. If you use the proper size formats (dp, sp, etc), your layout will scale to almost all resolutions. If you place images in the proper drawable folders (hdpi, ldpi, mdpi, etc), the OS will also swap those out as necessary.
Also, the emulator should handle resolutions for specific devices, if I recall correctly.
Desing lazout in smart way! Usualy it means don't put to mutch content in one layout.
Make sure that evrything looks good on smallest size and bigest size. It is better to treat tablets separetly. Read how providing alternative resources works, you can build sepereate layouts for each screen size.
Check if the hardware is available on that device before using it. hasSystemFeature() can be used for checking.

What is the best screen resolution for an Android AVD?

This is might seem to be a sort of silly question to ask but I would like to know while testing our apps what is the best resolution to be used (HVGA/WVGA/QVGA?etc)?
I ask this because I want the layout and the performance of the device to be consistent across most screen sizes.
There is a regularly updated diagram with the screen sizes and densitys available at the android developers site:
Source
This doesn't tell you an exact resolution, but seperates all phones into 4 sizes (small, normal, large, xlarge) and densities. This should give you a hint at least.
The biggest chunk is obviously Normal/hdpi, I guess that should be a lot of 3.7" HDPI displays with a 480x800 resolution (or at least close to this res). Like the Nexus One or HTC Desire (there are sure some newer ones, but I only keep an eye on the market when I'm searching for a phone to buy).
You can use all resolution to test your application, because some phones have QVGA resolution, some HVGA or WVGA resolution. Tablets have others resolutions.
More informations : http://developer.android.com/guide/practices/screens_support.html
If you use the dp unit for the sizes of your screen elements, then you shouldn't need to worry (as much) as this is a relative size, based on the pixel density of the screen.

How can I distinguish phone from tablet

Using Adobe AIR for Android, I'd like to find a way to distinguish a phone from a tablet. The closest I can find is detecting the dpi. (My phone dpi is 254, my tablet is 149) but is that going to be reliable or is there a better way?
(I've been using stackoverflow for a while but this is my first post - yippee!!)
but is that going to be reliable
Absolutely not. A T-Mobile G1 would be a tablet by that measure.
is there a better way?
Frankly, you should not be caring whether an Android device is a telephone, tablet, television, toaster, telescope, or toilet.
You should be caring about characteristics and capabilities.
For example, if you are thinking about tablets in terms of screen size, use <supports-screens> and the -large and -xlarge resource sets (e.g., res/layout/ for normal stuff and res/layout-large/ for larger screen sizes).
Or, if you are thinking about tablets in terms of whether or not you can place a phone call, use <uses-feature> and hasSystemFeature() on PackageManager.
Whether a device is a tablet or not could mean...
One.... Is it running the Honeycomb tablet version (Android 3.0) ? You can use System.getProperty() to get this information.
or
Two....Is it tablet sized? i.e. is the screen a larger size? But bear in mind some tablets are not that big. Best way to handle these is separate resources for each device size.
I'd say in general it's a bad idea to try to define Android tablets into specific groups, as there are many varieties now and a LOT more are coming. So usually best to build your app so it handles different screen sizes, different OS versions, and different features being available or absent (e.g. GPS, keyboard etc).
cdotspace, don't worry about the real dpi, you only need to get virutal dpi:
int virtual_dpi=webview1.getResources().getDisplayMetrics().densityDpi;
Virutal dpi means dots per virtual inch.
For example, the htc desire hd's real width is 2.21 inches, but its virutal width is still 2 inches, the galaxy tab 10.1's real width is 5.35 inches(portrait orient), but its virtual width is 5 inches.
int portrait_width_pixel=Math.min(this.getResources().getDisplayMetrics().widthPixels, this.getResources().getDisplayMetrics().heightPixels);
int dots_per_virtual_inch=this.getResources().getDisplayMetrics().densityDpi;
float virutal_width_inch=portrait_width_pixel/dots_per_virtual_inch;
if (virutal_width_inch<=2)
{//is phone
}
else
{//is tablet
}

Categories

Resources