Use HDPI Resources on Kindle Fire

1.7k views Asked by At

I'm currently looking into getting my android app to work on Kindle Fire. I've got artwork for both MDPI and HDPI screens, but I noticed that when I load the app up on the Kindle, it displays the MDPI artwork and stretches some of my artwork that I'm filling parent with a little more than I want.

I was wondering if there's any way on Android to under certain circumstances (like if I'm on a Kindle), force it to load from the HDPI artwork, instead of defaulting to MDPI.

I do realize that I could just save my HDPI artwork in the MDPI folder with a slightly different name and do a check for every resource, but that's a lot of overhead, not to mention an increase in the size of my app, which I'd also like to avoid.

Thanks

Update: Still looking at this one. I guess what I'm really getting at, is there a way for an android device to chose HDPI artwork instead of MDPI, even though the MDPI artwork exists?

3

There are 3 answers

0
user1174195 On BEST ANSWER

Ended up using a hack solution in the meantime, but I came across this:

I don't want Android to resize my bitmap Automatically

Pretty much just needed to move my hdpi images into the nodpi folder (in order to avoid the scaling issues) and changed the names slightly (I added a _hd to the name). After that I made an image loader that takes in the name of the image I want and returns _hd images if device is hdpi or if it's kindle fire:

id = ctx.getResources().getIdentifier(string + "_hd", "drawable", context.getPackageName());

Note: The docs do discourage the use of getIdentifier(), as it is less efficient than just using the resource address, but I took a look at the load times and loading 1000 images with getIdentifier takes .25 seconds, which is fine with me especially since I'm not loading anywhere close to that many images.

2
Chronos On

The Kindle Fire is 1024x600 with 160 dpi, right?

You can try new resourses with that resolution. And place them in the MDPI folder. Add layout-large at /res directory and copy your layout file there. That way, with the Kindle Fire, you use the layout at layout-large pointing to bigger resources in the MDPI folder.

And make sure you always use nine-patch drawables for resources.

Hope this helps you.

0
Trey Hall On

You can try new resources with that resolution and place them in the MDPI folder. Add layout-large at /res directory and copy your layout file there. That way, with the Kindle Fire, you use the layout at layout-large pointing to bigger resources in the MDPI folder.