0

我的代码如下:

private ImageView imageAvatar;
private Drawable image;
private BitmapDrawable drawable;

protected Bitmap doInBackground(Void... params) {
    // TODO Auto-generated method stub
    String url = "https://graph.facebook.com/" + userId + "/picture?width=" + width + "&height=" + height;
    image = ImageOperations(url);
    imageAvatar.setImageDrawable(image);
    imageAvatar.setMinimumHeight(32);
    imageAvatar.setMinimumWidth(32);
    imageAvatar.setMaxHeight(128);
    imageAvatar.setMaxWidth(128);
    IsFinish = true;
    drawable = (BitmapDrawable) imageAvatar.getDrawable();
    if(drawable != null) {
        return drawable.getBitmap();
    }
    return null;
}

我通过 检索数据taskImage.execute().get()。我知道get()如果需要计算会等待。我必须实现我的代码onPostExecute()以防止阻塞 UI 线程。

问题是:如果我想操作我的代码onPostExecute()以防止阻塞 UI 线程,结果不应该是Bitmap,但我想BitmapASyncTask.

我应该怎么办?

4

0 回答 0