Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ProfilePictureView to Bitmap (Facebook SDK for Android v3 )

How can I convert from ProfilePictureView to Bitmap? It's possible?

like image 542
Jose Manuel Avatar asked Dec 26 '22 10:12

Jose Manuel


2 Answers

I've got it!!

ImageView fbImage = ( ( ImageView)profilePictureFB.getChildAt( 0));
Bitmap    bitmap  = ( ( BitmapDrawable) fbImage.getDrawable()).getBitmap();
like image 117
Jose Manuel Avatar answered Jan 08 '23 09:01

Jose Manuel


You can also just enable the DrawingCache of the ProfilePictureView and then call a getDrawingCache... like this

 ProfilePictureView mImage = (ProfilePictureView) findViewById(R.id.profilepic);
 mImage.setDrawingCacheEnabled(true);
 mImage.setProfileId(user.getId());

and then when the profile picture is loaded...

 Bitmap bitmap = mImage.getDrawingCache();
like image 23
Nao Kreuzeder Avatar answered Jan 08 '23 09:01

Nao Kreuzeder