android: convert canvas to bitmap then save to SD card

后端 未结 2 512
北荒
北荒 2021-01-25 18:32

i\'m developing an android app where I can draw on a canvas. I want to convert my canvas to bitmap and then save it in jpeg format on my sd card..

how can i properly do

2条回答
  •  一整个雨季
    2021-01-25 18:49

    Did you look up the documentation?

    Canvas API

    You can use the:

    public Canvas (Bitmap bitmap)
    
        Since: API Level 1
        Construct a canvas with the specified bitmap to draw into. The bitmap must be mutable.
        The initial target density of the canvas is the same as the given bitmap's density.
        Parameters
    
        bitmap  Specifies a mutable bitmap for the canvas to draw into.
    

提交回复
热议问题