I have a Lenovo A1000 and a Samsung Galaxy Duos. You can see them in the attached pictures.
I am trying to make different values folders for each of them so I can fix some dimensions but they both just same to go under one folder. When I downloaded the What's my size app it detected them as they have similar screens? How is that even possible and is there any way I can detect the different screen sizes?
I tried with values-sw320dp-hdpi to catch the Lenovo, but the Samsung fell into it too. Any other ways?
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
As Sony Xperia U's resolution is 480 * 854 (280ppi) it should take images from high density folder(drawable-hdpi) but its taking images from extra high folder(drawable-xhdpi) and not scaling properly.We are not having actual device for testing so setting emulator Height=854 ,Width=480 and density=320.We have also added specific drawable-h854dp folder for xperia but it is still taking images from drawable-xhdpi and not scaling it.Has any one faced this kind of issue?Suggest us if have any ideas.
Thanks in advance!!
280ppi is directly between hdpi (240ppi) and xhdpi (320). Chances are, Sony has defined the Xperia U as an xhdpi device, so for it to take resources from drawable-xhdpi is completely normal. There's an app in the market I found called Check Screen Size that will tell you what density your device is defined as (and what resources it will be using).
If you put it under drawable-w240dp or drawable-h427dp or even drawable-w240dp-h427dp it should work.
I wouldn't bother too much since it's Sony's fault that they have not followed Android device guidelines for minimum (effective) screen size.
I am developing android app which has lots of images. It's a korean app.
I want to support maximum number of resolution possible.
So I created 4 different folder(ldpi, mdpi, hdpi, xhdpi) for drawable as the google doc stated.
Now my problem is that my app work on all most all device perfectly but In korea there is device Pantech Vega LTE M which is giving lots of trouble
It's resolution is of xhdpi category but still in this device my app shows images from mdpi and it show bigger than it resolution. So half of the image is displays compressed.
So I am not getting how to set the drawables for this device. Do i need to add separate drawable folder to match this resolution.
If i changes the images in mdpi folder than it will create problem for other resolution.
Beside how many folder I need to add make my app compatible with every possible resolution available.
Thats because that device runs Android 2.3 Gingerbread where the X-Large configuration was yet not supported since that resolution was supported beginning with Adroid 3.0 afaik.
Edit:
Looks like the xhdpi was supported since API level 9, and the configuration specs from your device looks like a normal - large screen with xhdpi. So the only workaround that I could think of is creating those folders within your drawables.
I have to put my Android application in a Galaxy tab. When I installed the app, the resolution of the UI of my application changed. But it's looking good in emulator and other Android 2.2 phones. But in Galaxy tab, the resolution is changed. Please help.
The Galaxy Tab has a pixel density of about 170. That isn't all that different from an mdpi device. (However, Android market apparently classifies it as an hdpi device.)
Are you sure that the problem is with the resolution? It's an extra large screen; perhaps that's causing problems?
I suggest getting device's (Samsung Galaxy Tab) height-width then optimise your resources according to them. Try to find out whether they lie in hdpi/mdpi or ldpi range
You may be required to use new set of graphics for them.