Android Canvas read background image, after doodle save

Source: Internet
Author: User

============ Problem Description ============


Use the following code to read the image inside the SD card and display it
Setbackgrounddrawable (New Bitmapdrawable (Bitmapfactory.decodefile ("/storage/sdcard/bg.jpg"));

Then the graffiti, after the completion of the graffiti to save, leaving only the graffiti of my strokes, the background map is not saved
because it is graffiti on the background map, how to make graffiti and background map to save
Save the Code:
Mycanvas.save (Canvas.all_save_flag); Mycanvas.restore ();        File F = new file ("/storage/sdcard/", "bg.jpg");        if (f.exists ()) {f.delete (); }fileoutputstream fos = null;try {fos = new FileOutputStream (f); mybitmap.compress (Bitmap.CompressFormat.JPEG, N, FOS); try {Fos.flush ();} catch (IOException e) {//TODO auto-generated catch Blocke.printstacktrace ();} try {fos.close ();} catch (IOException e) {//TODO auto-generated catch Blocke.printstacktrace ();}} catch (FileNotFoundException e) {//TODO auto-generated catch Blocke.printstacktrace ();}

============ Solution 1============


You can load a historical background image before saving the canvas, and then load the interface you want to save so that you can save the

Android Canvas read background image, after doodle save

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.