How can I create the bitmap from the canvas of custom view.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
There is no way to extract the
Bitmapout of aCanvas. The only way you can access it is to pass it yourself when creating the canvas like thisnew Canvas(myBitmap)and keep the reference.EDIT2: see @Alex comment blow – the approach of passing a
Bitmapto theCanvasdoes not seem to work for more recent versions of Android.EDIT : If you don’t create the
Canvasyourself, you could create a screen-sizedBitmap(or whatever size you need) and then pass it to theCanvasinonDrawcalls like this:canvas.setBitmap(myBitmap).