Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android - Screen Resolution and Screen Density

Tags:

android

As per managing resources(images) in > Android 1.6 version, we need to keep different-resolutions image in Drawable-Hdpi, Drawable-Mdpi, Drawable-Lpi folder particularly.

And as per this page: http://developer.android.com/guide/practices/screens_support.html ,

In Low density section - there are three resolutions used: 240*320 , 240x400 , 240x432 for the Small screen, Normal Screen, Large Screen particularly.

same way for Medium density section - there are three resolutions used: 320x480 , 480x800 , 480x854 for the Small screen, Normal Screen, Large Screen particularly.

and same way for High density ........

but i am confused here:

(1) How do i come to know that whether small, Normal or Large screen is used, i mean is there any way to know ?

(2) How do i come to know which type of density i am using ?

(3) And in Drawable-Hdpi, Drawable-Mdpi, Drawable-ldpi folder, which resolution's image we should keep particularly?

like image 914
Paresh Mayani Avatar asked Dec 21 '22 22:12

Paresh Mayani


2 Answers

There are specific Android API calls that can, at runtime tell you what density and (small/large/normal) screen size a handset has. However, as a developer we should not need to worry about individual handsets at all. All we need to do is to have ldpi/mdpi/hdpi assets and small/normal/large layouts in the apk. Android internally handles everything.

Dont forget to get an indepth understanding of how Android determines which assets to use and aliasing here.

like image 117
omermuhammed Avatar answered Jan 07 '23 19:01

omermuhammed


Why do you want to know the actual density? It's Android's business. But I'm sure there is a way to retrieve this information.

For development I put everything in the hdpi-folder. I also could put everything in a general Drawable Folder.

At the time u publish u can decide if u want to provide already downscaled resources for ldpi and mdpi. However, thats not necessary.

Update: Retrieve actual density with this class and best practices

Update 2: I found a 25 min video from Motorola discussing all those issues: Working with multiple screens

like image 31
OneWorld Avatar answered Jan 07 '23 18:01

OneWorld