I've got an Android app that uses both drawables from its own resources folder and from the resources folder of a package linked via shared user id.
I'm facing a decrease of the drawables' pixel density (resulting in interpolation artefacts) of only own resources** each time the app is run, while those linked*** appear normal.
Executing the app about the 10th time, it crashes*. Then loading for the 1st time displays all images in their original density.
The app is based on SDK version 1.6 and no specific density dependent resources, meaning strictly designed for 320 x 480px. The issue does appear neither on a device with a display size matching as above, nor in an emulator with both matching and larger display size. In the last case the images are correctly scaled to fit.
I don't know where (in the code) to start looking for the reasons of that bug.
Thanks in advance for any hints!
EDIT:
I should also mention that several Dialogs (e.g. ProgressDialog
) are drawn in half the size as before when reloading the application.
* Log output when the app crashes:
ERROR/AndroidRuntime(23632): FATAL EXCEPTION: main
ERROR/AndroidRuntime(23632): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.myapp/com.myapp.Paketliste}: android.view.InflateException: Binary XML file line #20: Error inflating class <unknown>
ERROR/AndroidRuntime(23632): Caused by: android.view.InflateException: Binary XML file line #20: Error inflating class <unknown>
ERROR/AndroidRuntime(23632): Caused by: java.lang.reflect.InvocationTargetException
ERROR/AndroidRuntime(23632): Caused by: android.content.res.Resources$NotFoundException: File res/drawable/buttons.png from drawable resource ID #0x7f020016
ERROR/AndroidRuntime(23632): Caused by: java.lang.IllegalArgumentException: width and height must be > 0
WARN/ActivityManager(2461): Force finishing activity com.myapp/.Paketliste
* * The image loaded by these lines appears as described above:
ImageView imageView_IconOfAnotherPackage = (ImageView) row
.findViewById(R.id.paketliste_installed);
imageView_IconOfAnotherPackage
.setImageResource(R.drawable.default_icon);
* * * Loading an image which appears WITHOUT AN ISSUE:
imageView_IconOfAnotherPackage
.setImageDrawable(this
.getPackageManager()
.getResourcesForApplication('com.myotherapp')
.getDrawable(0x7f020001)
);