【发布时间】:2010-09-11 14:17:47
【问题描述】:
我想在 imageview 中显示图像而不使用 id。
我会将所有图像放在原始文件夹中并打开
try {
String ss = "res/raw/images/inrax/3150-MCM.jpg";
in = new FileInputStream(ss);
buf = new BufferedInputStream(in);
Bitmap bMap = BitmapFactory.decodeStream(buf);
image.setImageBitmap(bMap);
if (in != null) {
in.close();
}
if (buf != null) {
buf.close();
}
} catch (Exception e) {
Log.e("Error reading file", e.toString());
}
但这不起作用我想使用其路径而不是名称来访问图像
【问题讨论】: