Question

I looked into several questions and answers but I still don't know exactly what could be the consequences of what I am doing on my app:

I setup a background image on my main activity, and I added this line to be sure the image will be displayed over the whole screen: setScaleType(ScaleType.FIT_XY) (my images can be a little stretched without any problem, it cannot be seen thanks to the textures used).

For now I only added the images in the xhdpi folder, since this density is the highest I plan to handle. Considering the images are automatically resized according to the screen, what is the point of having a specific image in every density folder?

An image in every folder makes the app size much bigger and it takes of course much more time to prepare.

What are the risks of not handling all the densities from xhdpi to lpdi?

EDIT: Example below of an image I use as a pattern. FYI, I use this code to multiply the pattern:

<?xml version="1.0" encoding="utf-8"?>
<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
    android:src="@drawable/butterfly" 
    android:tileMode="repeat" />

Example of background pattern

Was it helpful?

Solution 2

The devices with ldpi / mdpi are essentially low profile devices which have severely constrained resources like memory. If you are using large images for such devices, the issues you may face are:

  • An app that is slow to execute as large images have to be decompressed by the relatively less powerful CPUs
  • OutOfMemory errors due to the images not fitting the heap size of these devices.

Edit: This answer assumes that the OP understands the reason for Providing Alternate Bitmaps and is only interested in knowing the risks in not following the Best Practices.

OTHER TIPS


One downside of your approach is that sometimes larger icons need more details than smaller icons do. By using only one image for all densities you would also have the same amount of details in each case. Often, a lager and more detailed icon does not look good when scaled down (and vice-versa).

Nice article to read regarding this issue: http://www.pushing-pixels.org/2011/11/04/about-those-vector-icons.html

From here: http://developer.android.com/training/multiscreen/screendensities.html

Since Android runs in devices with a wide variety of screen densities, you should always provide your bitmap resources tailored to each of the generalized density buckets: low, medium, high and extra-high density. This will help you achieve good graphical quality and performance on all screen densities.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top