Which res folder will be used in 1920*1080 in Android? - android

FHD(Full HD) is 1920*1080.
Which the res folder would be used in FHD and what's the dpi value should be set?

The Smallest width is configured by manufacturer, so it may be varied. For instance, Nexus 7 and Kindle Fire HD both have 1280x800 screen resolution, but the smallest width of N7 is 600dp, while Kindle Fire HD is 533dp.
Here is a way to calculate this:
If 480x800 is mdpi(160) for 5 inch device, the screen dpi(screenDPI) of the device with resolution 1080X1920 is 160*(1080/480)=360 (NOTE: manufacturer might change this number). Then the smallestWidth = 1080/(screenDPI/160).
Use Configuration to find out all the information of the device.

It depends on the screen size because a 7' screen with FHD will not have the same dpi as a 17' screen with FHD. to know DPI I use this calculator :
http://members.ping.de/~sven/dpi.html
and for the folders please try the actual google documentation it is pretty complete:
http://developer.android.com/guide/practices/screens_support.html
hope it helps!

Related

How to find what density bucket the phone is in?

Slightly noob-ish question but I get confused when it comes to calculating what density bucket the phone falls in. I'll take my Galaxy S3 as an example.
It has a resolution of 1280 x 720 which means it has 306 dpi. Now, referring to the chart below, my phone falls in the hdpi category because it has more than 240 dpi but less than the 320 dpi needed to be an xhdpi screen. So, the phone is 853 x 480 DP (dividing by 1.5)
However, a screen information app on my phone tells me that it is an xhdpi screen. So, the phone is 640 x 360 DP (dividing by 2).
How do I know what correct density bucket my phone falls in?
Update:
I am trying to design my app for the top 10 Android phones in my country. So I am calculating their sizes in DPs to design UIs based on their "smallest width DPs". This isn't a one-off size calculation.
If you want to know it once, you can get an app like ScreenInfo and run it. If you want to know programmatically, you can add density folders, such as values-mdpi and values-xhdpi, place an xml file in it, say whoami.xml with the following content:
<resources>
<string name="density_bucket">mdpi</string>
</resources>
And, respectively:
<resources>
<string name="density_bucket">xhdpi</string>
</resources>
and then inquire from the app:
String densityBucket = getResources().getString( R.string.density_bucket );
Hey I recognize that chart! Mostly because I created it :D. To clarify, the chart shows what dpi each density bucket is baselined to, but cannot be used to determine which density bucket a device should be classified as. That said, this illustration below shows how devices are generalized into density buckets, and you can see they may have a higher or lower dpi than the bucket they fall in.
Now to answer your question, unfortunately, there is no guaranteed way to know what density bucket a device will fall into purely based off of its specs. This is because the device manufacturer is able to choose the density bucket. Most of the time, they will choose the bucket closest to the actual dpi of the device**. Luckily, Google has gathered a list of common devices, along with their screen dimensions in dp, and density buckets. This should give you an idea of how to properly support the most prevalent screen size that are out in the wild.
**Note: Some devices have their own special density buckets. Most notably, the Nexus 7 (2012) is 213dpi (tvdpi), the Nexus 5X is 420dpi, and the Nexus 6 and 6P are 560dpi. These devices grab assets from the other density versions and scale them.
I think Android tries to find the "best match". So if 306 is in between 240 and 320, its much more closer to 320. So it will use xhdpi. You can read more here. Quoting from the official link to docs:
Based on the size and density of the current screen, the system uses any size- and density-specific resource provided in your application. For example, if the device has a high-density screen and the application requests a drawable resource, the system looks for a drawable resource directory that best matches the device configuration. Depending on the other alternative resources available, a resource directory with the hdpi qualifier (such as drawable-hdpi/) might be the best match, so the system uses the drawable resource from this directory.

Why didn't I get the emulator screen resolution I asked for?

I tried to create an emulation of the Samsung Galaxy II i9100. All I really care about is screen size and pixel density. I created the following device definition:
And this virtual device:
But the emulated device looked like this:
Why was the resulting size 480x736? And the dpi value is slightly off.
ETA: here is what my app looks like:
And here is the output of ShowResources on an actual Samsung S2 i9100
First Galaxy S2 is HDPI, not TVDPI, also note that TVDPI is not a "primary density group" per Android documentation:
Resources for screens somewhere between mdpi and hdpi; approximately
213dpi. This is not considered a "primary" density group. It is mostly
intended for televisions and most apps shouldn't need it—providing
mdpi and hdpi resources is sufficient for most apps and the system
will scale them as appropriate. If you find it necessary to provide
tvdpi resources, you should size them at a factor of 1.33*mdpi. For
example, a 100px x 100px image for mdpi screens should be 133px x
133px for tvdpi.
source: http://developer.android.com/guide/practices/screens_support.html
On why the screen report 480x736, the 64 pixels is used by the system soft buttons (back, home, recent apps). To remove the soft buttons, you have to use/create a Device Definition that sets Buttons option to "Hardware", as exemplified below:
Alternative you can use Nexus S's Device Definition, it would have the correct buttons and DPI settings.

Galaxy S3 and Galaxy S4 with layout-sw360dp

Kindly I want to know why Galaxy S3 and S4 get the images from this folder (drawable-sw360dp-xhdpi)??
all images seem very large for these devices !
also If I make these images smaller they will not be suitable for larger devices !
Please, what is the solution?
I assume you are using layouts for 10 inch and 7 inch devices are layout-sw720dp and layout-sw600dp then you just create drawable-sw720dp and drawable-sw600dp, also in the case of high density for those xlarge and large screen devices then append the corresponding density to the drawable folder . For example use drawable-sw600dp-hdpi for high density 7 inch tablets like ASUS MeMO Pad HD 7'. Now resource for large and xlarge are solved
Now Consider the drawable-sw360dp devices.
drawable-sw360dp/layout-sw360dp are for phablet devices like Note1,Note2, Micromax CanvasHD,S3.
The above mentioned devices are XHDPI devices. For using drawables either you can use drawable-xhdpi or use drawable-sw360dp-xhdpi
Thus you can distinguish resources for s3,s4 from xlarge and large screen devices.
Note : S3 and s4 taking images from drawable-sw360dp-xhdpi because smallest width of those devices are 320dp. You can check the device display information by installing screen info app from the playstore.
check screen info app here
res/drawable-mdpi/my_icon.png // bitmap for medium density
res/drawable-hdpi/my_icon.png // bitmap for high density
res/drawable-xhdpi/my_icon.png // bitmap for extra high density
http://developer.android.com/guide/practices/screens_support.html
It is based on the dpi
even now there is a xxhdpi folder or I may be wrong on that one??? Some one else to confirm that?

Android: Getting confused with density per pixel and qualifier on android folders

I have a bit confused with the qualifier. I am dealing with kindle fire 7" and 8.9, galaxy s4.
Kindle Fire 7inch: I need to use values-large-hdpi instead of values-sw600dp in order to work.
Kindle Fire 8.9inch: I can use values-sw600dp not for values-large-hdpi.
Galaxy s4 what qualifier should I use.
the qualifiers refer to what the screen dimensions are. So values-large-hdpi will apply to screens that have a minimum density of hdpi and are classified as a large screen type. The sw600dp means that the in order to use those values the screen must have a minimum width of 600dp. So my guess is that the Kindle Fire 7 inch does not meet the sw600dp requirments (Try holding it in landscape, that might work). But the 8.9 inch (being larger) would meet these requirements. The Galaxy s4 my guess falls into the xhdpi density range, not sure about screen size. Most phones will use normal, but the s4 having such a large screen might qualify to large. I would recommend using a screen width quantifier anyways, as just using hdpi or large is to vague.

how to design tablet ui with high resolution but less density screens?

I want the emulator to make use of the files present in the xhdpi folder and at the same time it should have low density. My emulator is set to a resolution of 1280 X 800 similar to motorola xoom tablet. Now if i keep a density of 149 ppi, android does not access the xhdpi folder. Please help. TIA.
Do not misunderstand Screen size, Screen density and Resolution. Read this article first.

Categories

Resources