Created
September 9, 2016 04:29
-
-
Save dmpatel151282/63367672388e8a2ba55c1fd97f266c20 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Bitmap snapshot = null; | |
Drawable drawable = null; | |
view.setDrawingCacheEnabled(true); | |
view.setDrawingCacheQuality(View.DRAWING_CACHE_QUALITY_AUTO); // Quality of the snpashot | |
try { | |
view.layout(0, 0, 110, 110); | |
snapshot = Bitmap.createBitmap(view.getDrawingCache(true)); // You can tell how to crop the snapshot and whatever in this method | |
drawable = new BitmapDrawable(snapshot); | |
} catch(Exception ex) { | |
ex.printStackTrace(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment