[android-developers] Re: How to save a canvas to disk

2009-09-29 Thread limtc
Thanks! After experiementing, seems to work. I think all I need to do is to do the view.draw(canvas) prior to have the canvas filled with what's drawn on screen. I am still exactly sure what's happening though, as basically I just do everything as it is, and create a new bitmap and a new canvas

[android-developers] Re: How to save a canvas to disk

2009-09-25 Thread gjs
Hi, That is why I gave you a complete working example ( maybe try it yourself ). But not knowing your code I could only guess about when you would want to call the saveView() method I provided. I guess that you would call the saveView() method when the user requests that your KidsPaintView view

[android-developers] Re: How to save a canvas to disk

2009-09-24 Thread gjs
Hi, I made up the following to demonstrate what I meant. In this example when you press the trackball/dpad center button the view is written to a png file and also set as the wallpaper. You can change it to save as jpeg file etc. Hope that helps. Regards

[android-developers] Re: How to save a canvas to disk

2009-09-24 Thread limtc
Thanks! I think the part that I am confused is that I never used view.draw (canvas) code in my program so I don't know when to call it... at this moment, says I wanted to clear a screen, this is my code in the view: public void clearScreen() { gradient = false; dots.clear();

[android-developers] Re: How to save a canvas to disk

2009-09-23 Thread gjs
Hi, Have a look at - http://developer.android.com/reference/android/view/View.html#draw(android.graphics.Canvas) - create a new bitmap and a new canvas, associate the bitmap with this canvas and call view.draw( your_new_canvas ) - using your KidsPaintView view instance - then save the bitmap