• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to save a Path & Paint object to file.

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi everyone,

Now I'm using canvas.drawPath(Path path, Paint paint) to draw a path
which is created by user with a specified paint.
And before closing this app ( like PhotoShop app), I want to save this
Path and Paint. For the next time. So, user can start at their
previous canvas(screen).

Some said that they should be converted to bytearray [] and use
FileOutputStream to write it to file.
But I don't know how to do that.

Please, help me. I really really need your advice.
Thanks so much.
 
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Assuming that you created a bitmap for the canvas to draw into, you could use the Bitmap.compress() method to write the bitmap to a file.

http://developer.android.com/reference/android/graphics/Bitmap.html#compress(android.graphics.Bitmap.CompressFormat,%20int,%20java.io.OutputStream)
 
reply
    Bookmark Topic Watch Topic
  • New Topic