您好我已经在我的应用程序中实现了Facebook登录,现在我正在尝试下载用户个人资料图片并将其传递到RoundedImageView 但是,当我测试它并且没有显示图像时遇到错误,错误是:
skia﹕ --- SkImageDecoder::Factory returned null
我也在它之前直接得到这两个错误
ReadStreamToBuffer : Qmage Stream read error!! required length 12 bytes, but red 0 bytes
isQmage : input SkStreamRewindable length is less than Qmage minimum size : 0
这是我下载和设置图像的主要asynctask
private class DownloadImageTask extends AsyncTask<String, Void, Bitmap> {
private ImageView bmImage;
public DownloadImageTask(ImageView bmImage) {
this.bmImage = bmImage;
}
protected void onPreExecute() {
}
protected Bitmap doInBackground(String... urls) {
String userId = urls[0];
Bitmap bmp = null;
try {
URL image_value = new URL("http://graph.facebook.com/"+ userId + "/picture?type=large");
bmp = BitmapFactory.decodeStream(image_value.openConnection().getInputStream());
} catch (IOException e) {
Log.e("Error", "image download error");
Log.e("Error", e.getMessage());
e.printStackTrace();
}
return bmp;
}
protected void onPostExecute(Bitmap result) {
bmImage.setImageBitmap(result);
}
}
这就是我称呼它的方式
final RoundedImageView profilePic = (RoundedImageView) rootView.findViewById(R.id.myProfilePic);
new DownloadImageTask(profilePic).execute(userId);
感谢您提供的任何帮助