BitmapFactory.decodeResource returns null value
- by krasnoff
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