mardi 30 décembre 2014

Facebook avatar has low quality on ImageView - android


Vote count:

0




I'm kind new at android development. I'm working on a project which contains facebook sdk for sign in. Now, my problem is that I want to show the facebook avatar on ImageView, but the image has very low quality. Here is my code:



@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_user_profile);

ImageView imgProfilePic = (ImageView) findViewById(R.id.profilePicture);
new LoadProfileImage(imgProfilePic).execute("https://graph.facebook.com/"+ID+"/picture?type=square&width=150&height=150");
}

private class LoadProfileImage extends AsyncTask<String, Void, Bitmap> {
ImageView bmImage;

public LoadProfileImage(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);
}
}


Thanks.



asked 26 secs ago







Facebook avatar has low quality on ImageView - android

Aucun commentaire:

Enregistrer un commentaire