1

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)
  );
klaus
  • 1,806
  • 17
  • 20
  • Could you post the code where 1) you load you resources into memory and 2) where you set your image resources to an ImageView. And just to clarify - you are only experiencing this behaviour on a device with a larger screen size? Also does it get worse every time you reload the app? – Joseph Earl Apr 05 '11 at 15:19
  • Thanks, Joseph! Yes, I'm not experiencing this on a screen size as big as the layout. And yes, it keeps getting worse (halving the images' resolution and the size of Dialogs) on each reload. This finally results in a crash. – klaus Apr 06 '11 at 19:03

1 Answers1

1

I found a post where a guy presumably was having the same problem (and found a solution) here:

http://adrianvintu.com/blogengine/post/Force-Locale-on-Android.aspx

(via this answer: Set-up the application Language in Android Preferences)

Community
  • 1
  • 1
klaus
  • 1,806
  • 17
  • 20