BitmapFactory.decodeResource returns null value

Posted by krasnoff on Stack Overflow See other posts from Stack Overflow or by krasnoff
Published on 2010-12-09T22:05:57Z Indexed on 2011/01/12 7:53 UTC
Read the original article Hit count: 146

Filed under:

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

© Stack Overflow or respective owner

Related posts about android