dimanche 21 septembre 2014

Get ImageView bitmap


Bitmap bitmap = ((BitmapDrawable)image.getDrawable()).getBitmap();
Be carefull to check if your image.getDrawable() can actually be cast to BitmapDrawable (to avoid ClassCastExceptions). 
If, for instance, you use layers in your image then this snippet will be slightly different: Bitmap bitmap = ((BitmapDrawable)((LayerDrawable)image.getDrawable()).getDrawable(0)).getBitmap(‌​);
http://stackoverflow.com/questions/8306623/get-bitmap-attached-to-imageview

Aucun commentaire:

Enregistrer un commentaire