How to Draw something with your finger in an Android App… And save it to the web

后端 未结 2 704
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-02-05 23:51

**THIS QUESTION WAS SUCCESSFULLY ANSWERED AND HAS BECOME A BLOG POST <- click **

Hi I am a PHP developer I want to do a simple thing - I want to draw something drawn

2条回答
  •  有刺的猬
    2021-02-06 00:19

    I'm not sure what part of the "save" you are trying to accomplish, but I'll assume you're asking how to store what you've drawn on the canvas to a bitmap.

    First, make yourself a bitmap to draw into. Say, canvasBitmap. Then:

    c.setBitmap(canvasBitmap);
    

    This will store everything that has been drawn into 'canvasBitmap.' Then, when the user presses a button to save:

    savedBitmap = Bitmap.copy(canvasBitmap.getConfig(), true);
    

    Now, take savedBitmap and fire it off into the cloud. Hope that helps.

提交回复
热议问题