我正在尝试从profilepictureview检索Facebook图像并将其转换为位图,但它给了我一张空白的个人资料照片。我的主要目标是将图像视图转换为CircularImageView。
https://github.com/Pkmmte/CircularImageView
代码在onCreate方法中设置:
profilePictureView = (ProfilePictureView) findViewById(R.id.image_mainlobby);
profilePictureView.setProfileId(userid);
profilePictureView.setPresetSize(ProfilePictureView.LARGE);
ImageView fbImage = ( ( ImageView)profilePictureView.getChildAt( 0));
Bitmap bitmap = ( ( BitmapDrawable) fbImage.getDrawable()).getBitmap();
ImageView im = (ImageView)findViewById(R.id.fb_profile);
im.setImageBitmap(bitmap);
答案 0 :(得分:1)
1)onCreate方法:
private class DownloadImageTask extends AsyncTask<String, Void, Bitmap> {
2)创建一个新类
public DownloadImageTask(ImageView bmImage) {
this.bmImage = bmImage;
}
protected Bitmap doInBackground(String... urls) {
String urldisplay = urls[0];
Bitmap mIcon11 = null;
try {
InputStream in = new java.net.URL(urldisplay).openStream();
mIcon11 = BitmapFactory.decodeStream(in);
} catch (Exception e) {
Log.e("Error", e.getMessage());
e.printStackTrace();
}
return mIcon11;
}
protected void onPostExecute(Bitmap result) {
bmImage.setImageBitmap(result);
}
}
ImageView bmImage;
$(document).ready(function () {
$.ajax({
type: "GET",
url: "jqueryXML.xml",
dataType: "xml",
success: function (xml) {
$(xml).find("movie").each(function () {
var title = $(this).find("title").text();
$(".list ul").append("<li>" + title + "</li>");
});
},
error: function () {
alert("error");
}
});
});