Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android change resource qualifier programmatically

Tags:

android

Is it possible programmatically change resource configuration qualifier? I mean, make system for some hdpi devices took resources from xhdpi folder instead of hdpi.

like image 636
Yomodo Avatar asked Sep 17 '12 20:09

Yomodo


1 Answers

In my project i have ldpi, mdpi, hdpi and xhdpi image resources. For Kindle fire(1024 x 600 - 169 dpi) android system takes resources from mdpi folder and application looks very bad. I want to make android took resources from hdpi folder.

Related to your comment I usually provide resources only for hdpi screen and all other densities work fine. Testing at 2.1+ or 2.2+ devices which I usually target!

I understand the risk that is not documented, so it will not supposed to work although it does! In that way I avoid the some KB from my final apk.

But I do not suggest using xhdpi instead of hdpi as xhdpi works only in 3+ or something devices.

Just for testing different densities on a single device you can change AVD by:

am display-density 480 

See android doc for more info: http://developer.android.com/tools/help/adb.html#shellcommands

like image 110
madlymad Avatar answered Oct 22 '22 09:10

madlymad