I've run into a formatting issue regarding the Galaxy S and Galaxy S2. Perhaps someone can share some insight. When testing my app on the two emulators which I downloaded from the Samsung site, the emulator pulls graphic resources from the drawable-xhdpi folder and the graphics are way too large. I confirmed this by setting different graphics in each drawable-<density> folder. The phone specs for the S2 are 480 x 800 pixels, 4.3" screen size (works out to ~217ppi screen density) so I would expect the emulator to pull from the hpdi folder. The emulator setting for the the S2 declares an abstracted LCD density of 300 while hw.lcd.width and hw.lcd.height are 480 and 800 respectively. Is the abstracted LCD Density set incorrectly by the manufacturer and should I change it in the hardware settings to 217 to get an accurate representation on the actual device? I haven't been able to test on a Galaxy S or S2 device and I'd hate to have to write a special case to deal with a particular phone type as this is bad practice.
Related
I'm trying to set up specific values/drawable folders for all screen devices but it is quite complicated, for example I have 2 similar phones :
HTC Pixel which has resolution 1920x1080 (screen size 5") and,
HTC 5X which has same 1920x1080 resolution (screen size 5,2").
For this type of phones I have values-xxhdpi and also same folder for drawable drawable-xxhdpi. Should this phones use same folders? because on both looks it differently and this is quite strange.
On my Lg G stylo h634, it has a resolution of (720*1280) w/ a size of 5.7 inches and a real PPI of 258. With this information this phone should have:
DP width: 240
DP height: 240
Density: 1.5
Density PPI: 240
However when i run my test on this real device it's giving me:
DP width: 257
DP height: 258
Density: 2.0
Density PPI: 320
Now when i run an emulated version of my phone with the same specs, the first metrics are given (density: 1.5, PPI: 240, etc) which are the proper metrics. I'm not sure why this is happening, but can anybody explain why an emulated version is more accurate than the real device?
Its not always about the DPI and PPI. The real phone comes with variety of hardware components. although the specs of real phone and emulator is same but real phone renders things differently also it scale things differently. My advice is try to run you app. on few more physical devices and compare to emulator one of equivalent specs result would not differ much.
but can anybody explain why an emulated version is more accurate than the real device?
It's not. The device is what the device is.
On DisplayMetrics, xdpi and ydpi are the actual physical density values. For example, the documentation for xdpi has:
The exact physical pixels per inch of the screen in the X dimension.
In your question, you state that the device has "a real PPI of 258". That fits the values that you are getting from DisplayMetrics, bearing in mind that pixels are rarely square, so the xdpi and ydpi values are rarely exactly equal.
The value for density is based on a manufacturer setting (ro.sf.lcd_density in /system/build.prop, I think). Why LG decided to go with xhdpi instead of hdpi, I cannot say. If I had to guess, they felt that existing apps looked better on the device with that logical density. The emulator will use its own algorithm. Another manufacturer with a similar screen might choose hdpi (what the emulator chose).
The value for densityDpi is driven directly from density.
I have developed a clock widget. And I only have 1 res/layout and 1 res/drawable. Everything works perfectly.
It works on mdpi like Samsung Galaxy Ace. It works on hdpi like Samsung Galaxy S2. It works on xhdpi like Samsung Galaxy Note.
However I got ugly look on 720x1280 devices such as Samsung Galaxy Nexus or Sony Xperia S. And coming soon Samsung Galaxy S3.
When I provide res/layout/xhdpi which I built specifically for 720x1280 devices and then Galaxy Note will also use this layout and it looks ugly on Galaxy Note.
How to address this issue?
It is like some crossing between 720x1280 (Galaxy Nexus, Sony Xperia S, Galaxy S3) and 800x1280 (Galaxy Note).
The resolution and DPI of the device don't necessarily match up (high resolution doesn't mean high DPI). DPI is a ratio of the resolution of the device and its physical dimensions.
Instead of separating your layout folders by DPI, separate them by dimensions. For instance, layout-large, layout-xlarge. You can also quantify by specific sizes, such as layout-w720-h1280, in which case that would match only device with a minimum width of 720 pixels and minimum height of 1280 pixels.
Use layout-sw320dp for Galaxy S3
Ideally I'd have a heap of physical devices to test on, but in reality I don't have access to devices with all the different characteristics.
I'm targeting Android 1.6-current (4.0.3 at the moment), primarily phones, but also want the app to be at least somewhat usable on tablets.
The configurations I've been usually testing with until now:
Android 1.6, 320x480 MDPI
Android 2.2, 480x800 HDPI
Android 4.0, 480x800 HDPI
(landscape and portrait, with and without network connection)
I'm thinking of a set of configurations that wouldn't be excessively large but still would give good coverage of various devices "out there". What Android emulator configurations would you suggest?
Update:
Based on the answers I added this configuration to the list:
240x320 LDPI (QVGA skin)
Important to note is that it has 3:4 aspect ratio, different from 3:5 that WVGA has. If layout is tuned to just barely fit in WVGA, scaling down to QVGA can reveal problems. Good idea to check!
Also, added simulated Galaxy Nexus. Just to realize from now on I'll need xhdpi graphics (blurry icons: not acceptable!):
720x1280, no hardware buttons (WXGA720 skin), no SD card
What about 240*320 ldpi ? like xperia mini, motorola, cliq
Well, I'd suggest you add LDPI configuration (which is QVGA - 320x240 and has 0.75 density) as far as there are a lot of devices with such screen resolution.
How can I test my app on high density, large screen emulator?
I'm asking about this specifically because it is not listed at "Table-3" in http://developer.android.com/guide/practices/screens_support.html...
Thanks.
Samsung released a Galaxy Tab AVD. You can dowload it from your Android AVD manager. It is not a Galaxy S but you will face some of the Samsung's specificities with it. I experienced that a week ago: a bug not reproduceable under HTC or Motorola was reported under Galaxy S - I could reproduce it with the Galaxy Tab.
The AVD system also allows you to change the size of the virtual device and to edit its abstracted density setting, so to emulate a large screen / high density.
By the way, the Galaxy S is a 4 in. / 480x800 (source: Samsung). This is not a large screen, is it?
Though its not listed, Galaxy S would surely come under a high density, large screen emulator. That should exactly work as you needed!
You can create custom AVD Emulator with whatever density and resolution you need.