80,471
社区成员




/** 从缓存中获取图片 **/
public Bitmap getImage(final String url) {
final String path = getDirectory() + "/" + convertUrlToFileName(url);
System.out.println("path:"+path);
File file = new File(path);
if (file.exists()) {
Bitmap bmp = BitmapFactory.decodeFile(path);
if (bmp == null) {
file.delete();
} else {
updateFileTime(path);
return bmp;
}
}
return null;
}
if (result == null) {
System.out.println("内存中没获取到");
// 文件缓存中获取
result = fileCache.getImage(url);
if (list.size() >= (1 + arg0)) {
hdbean = list.get(arg0);
carxing.setText(hdbean.getActivityName());
time.setText(hdbean.getSendTime());
// time.setText(hdbean.getValidityTime());
Bitmap b1 = Snippet.getBitmap(URLs.http_head + hdbean.getPicture(),
new ImageCallback() {
public void imageLoaded(Bitmap imageDrawable,
String imageUrl) {
BitmapDrawable s = new BitmapDrawable(imageDrawable);
huodongview.setBackgroundDrawable(s);
}
});
if (b1 != null) {
BitmapDrawable b = new BitmapDrawable();
b =(BitmapDrawable) hdcontext.resizeImage(b1, 150,100);
// BitmapDrawable s = new BitmapDrawable(b1);
huodongview.setBackgroundDrawable(b);
}
}