BitmapDrawable: prevent garbage collection while in use

This commit is contained in:
Julian Winkler
2024-08-05 22:57:28 +02:00
parent 5a73787a3d
commit 9fda1b36e6
2 changed files with 4 additions and 6 deletions

View File

@@ -36,7 +36,8 @@ public class BitmapDrawable extends Drawable {
throws XmlPullParserException, IOException {
final TypedArray a = r.obtainAttributes(attrs, R.styleable.BitmapDrawable);
if (a.hasValue(R.styleable.BitmapDrawable_src)) {
paintable = a.getDrawable(R.styleable.BitmapDrawable_src).paintable;
bitmap = ((BitmapDrawable)a.getDrawable(R.styleable.BitmapDrawable_src)).bitmap;
paintable = bitmap.getTexture();
}
a.recycle();
}