Issue
As explained in Developer documentation Android supports setting different images for different sizes of the screen by putting them in separate folders (drawable-small, drawable-normal, drawable-large and drawable-xlarge).
Is it possible to get the "type" of the screen that Android is using to load the resources during runtime? I need to log this variable for error reporting and it would help a lot if I can tell which drawable type folder system is using (similarly to how I can tell if it is ldpi, mdpi, hdpi or xhdpi by querying getResources().getDisplayMetrics().density).
Solution
Is it possible to get the "type" of the screen that Android is using to load the resources during runtime?
getResources().getConfiguration()
gives you a Configuration
object, and from there you can examine the screenLayout
field. This tells you size, long/not-long, and direction (LTR or RTL).
Answered By - CommonsWare
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.