inPurgeable cannot be resolved or is not a field

Android 码拜 9年前 (2015-04-23) 894次浏览 0个评论
 
	public Bitmap ReadBitMap(Context context, int resId) {
	    BitmapFactory.Options opt = new BitmapFactory.Options();
	    opt.inPreferredConfig = Bitmap.Config.RGB_565;
	    opt.inPurgeable = true;//报错inPurgeable cannot be resolved or is not a field
	    opt.inInputShareable = true;//报错inInputShareable cannot be resolved or is not a field
	    // 获取资源图片
	    InputStream is = context.getResources().openRawResource(resId);
	    return BitmapFactory.decodeStream(is, null, opt);
	}

大神怎么破?

inPurgeable cannot be resolved or is not a field
20分
我怎么没报错,你这不是运行时错吧, 
inPurgeable cannot be resolved or is not a field
不是的,这个地方有个小红×
inPurgeable cannot be resolved or is not a field
引用 1 楼 guoyoulei520 的回复:

我怎么没报错,你这不是运行时错吧, 

估计是我的版本不对,不是运行时出错

inPurgeable cannot be resolved or is not a field
引用 3 楼 henha2jiang 的回复:
Quote: 引用 1 楼 guoyoulei520 的回复:

我怎么没报错,你这不是运行时错吧, 

估计是我的版本不对,不是运行时出错

我没有问题啊

inPurgeable cannot be resolved or is not a field

今天也遇到这问题了。
网上都是爬此文章的答案。并没有解答。

不过我顺利解决了。
报错inPurgeable cannot be resolved or is not a field
因为你工程当前的Android版本太低了。
更换一个高版本如Android4.0 的sdk即可。


CodeBye 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权 , 转载请注明inPurgeable cannot be resolved or is not a field
喜欢 (0)
[1034331897@qq.com]
分享 (0)

文章评论已关闭!