Created
November 16, 2021 08:29
-
-
Save jaikeerthick/e79bf266f1d3f9358997819a431f940e to your computer and use it in GitHub Desktop.
Convert any view to Bitmap
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
class ShareScreenshot { | |
fun getBitmapFromView(view: View): Bitmap? { | |
val bitmap = Bitmap.createBitmap(view.width, view.height, Bitmap.Config.ARGB_8888) | |
val canvas = Canvas(bitmap) | |
view.draw(canvas) | |
return bitmap | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment