getBmpfromSd

来源:互联网 发布:汉高百得美缝剂淘宝 编辑:程序博客网 时间:2024/06/16 01:37
public Bitmap getBmpfromSd(String savePath, String name) {
if (savePath.trim() == null || savePath.trim().length() == 0
|| name.trim() == null || name.trim().length() == 0)
return null;

String sName = strConvert(name);
File dir = new File(savePath);
File[] files = dir.listFiles();
if (files == null) {
return null;
}
Bitmap bitmap = null;
for (int i = 0; i < files.length; i++) {
if (files[i].getName().equals(sName)) {
bitmap = BitmapFactory.decodeFile(savePath + "/" + sName);
vBmp.add(bitmap);
break;
}
}
return bitmap;
}
原创粉丝点击