在onCreate事件我做一個異步請求Facebook的API:更新的ImageView的Android
Utility.mAsyncRunner.request(null, params1,
new myListener());
在myListener的公司的onComplete事件中,我想設置圖像中的ImageView
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());
}
}
}
問題是imageview沒有刷新我設定的新圖片。 它設置它,它不會刷新它。如果我鎖定並解鎖手機,則圖像應該顯示。 我該如何強制刷新imageview? 謝謝!
它不見了404 :( – dinigo 2012-10-02 22:26:32
@ demil133我剛更新了鏈接,希望它有幫助 – SERPRO 2012-10-03 08:57:41