BitmapFactory.de codeResource返回空值 [英] BitmapFactory.decodeResource returns null value

查看:1055
本文介绍了BitmapFactory.de codeResource返回空值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我特林从内部资源加载位图在视图对象(源本身就是绘文件)。

I am tring to load bitmaps from an internal resource in a View object (the source itself is in "drawable" files).

在code是:

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);

 }
}

为什么m_Banner值为null?

Why m_Banner value is null?

感谢您提前

了Kobi

推荐答案

请确保所有的SDK其它的组件(如Eclipse中,Android SDK中,SDK插件为月食都是最新的)。

Please make sure that all the sdk componenets (E.G Eclipse, Android SDK, SDK plug in for eclipse are all up to date).

这篇关于BitmapFactory.de codeResource返回空值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆