private Bitmap getImageFromAssetsFile(String fileName)
{
Bitmap image = null;
AssetManager am = getResources().getAssets();
try {
InputStream is = am.open(fileName);
image = BitmapFactory.decodeStream(is);
is.close();
}
catch (IOException e) {
e.printStackTrace();
}
return image;
}
------解决方案--------------------
这段代码没什么问题。。你是怎么调用的,传入的文件名对吗?
------解决方案--------------------
空指针就容易多了,你看哪个对象 空的,
InputStream is = am.open(fileName); 文件名正确否
image = BitmapFactory.decodeStream(is); 解码成功否?Z
有没有异常信息呢?