There are special Android API calls that can tell you during operation what density and (small / large / normal) screen size the phone has. However, as a developer, we do not need to worry about individual phones at all. All we need to do is have ldpi / mdpi / hdpi assets and small / normal / large layouts in apk. Android internally handles everything.
Remember to get a deep understanding of how Android determines which assets to use and overlay like this .
Definitions:
xlarge screens of at least 960dp x 720dp.
Large screens of at least 640dp x 480dp.
normal screens at least 470dp x 320dp.
small screens of at least 426dp x 320dp. (Android does not currently support screens smaller than this.)
Here are some more examples of how this works with real screens:
The QVGA screen has a size of 320x240 ldpi. Converting to mdpi (4/3 scaling factor) gives us 426dp x 320dp; this corresponds to the minimum size specified above for a small screen.
Xoom is a typical 10-inch tablet with a 1280x800 mdpi screen that puts it in the square of the xlarge screen.
Dell Streak - 800x480 mdpi screen. This places it at the bottom of a large bucket.
A typical 7-inch tablet has a screen of 1024x600 mdpi. It is also considered a large screen.
kyogs
source share