I am tring to load bitmaps from an internal resource in a View object (the source itself is in "drawable" files).
the code is:
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.util.AttributeSet;
import android.view.View;
public class BannerView extends View {
private Bitmap m_Banner = null;
public BannerView(Context context, AttributeSet attributeSet) {
super(context, attributeSet);
m_Banner = BitmapFactory.decodeResource(getResources(), R.drawable.banner);
}
}
Why m_Banner value is null?
thank you in advance
Kobi
Eclipse Project -> Clean helped in my case.
I have the same problem too, but I've found that if I put the picture into drawable-ldpi, it works fine. I do not know why, but this worked for me.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With