【发布时间】:2012-11-21 21:38:27
【问题描述】:
在 onCreate 事件中,我向 facebook api 发出异步请求:
Utility.mAsyncRunner.request(null, params1,
new myListener());
在 myListener 的 onComplete 事件中,我想在图像视图中设置图像
public class PhotoDisplayListener extends BaseRequestListener {
@Override
public void onComplete(final String response, final Object state) {
//set my image with the url provided in the response
...parse json....
ImageView img = (ImageView)findViewById(R.id.img);
URL ulrn = new URL(photourl);
HttpURLConnection con = (HttpURLConnection)ulrn.openConnection();
InputStream is = con.getInputStream();
Bitmap bmp = BitmapFactory.decodeStream(is);
if (null != bmp){
img.setImageBitmap(bmp);
setImage(bmp);
}
else
System.out.println("The Bitmap is NULL");
}catch(Exception e){} catch (FacebookError e) {
// TODO Auto-generated catch block
e.printStackTrace();
showToast(e.getMessage());
}
}
}
问题是图像视图没有用我设置的新视图刷新。 它设置它,它不会刷新它。如果我锁定和解锁手机,图像会按原样显示。 如何强制刷新图像视图? 谢谢!
【问题讨论】: