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 should save their 'drawing'
either to a file or to set as the wallpaper.

I imagine that you would provide a menu option button, or some
touchscreen or keyboard button to allow the user to trigger that
action - when they had finished making their 'drawing'. I just used
the trackball/dpad center button as an example to demonstrate
triggering and saving the view.

In my example I used 'SomeView' to represent your KidsPaintView and
put the saveView() method in the Activity, but you could also put the
saveView() method or some equivalent code inside your KidsPaintView
view if you wish.

You should also realize that you CAN just call draw( canvas ) on your
KidsPaintView as your class extends View so it (automatically)
inherits the View.draw( canvas ) method... You just need to ensure
that you create and use a new canvas and a new bitmap when calling the
draw( canvas) method, as I said originally and demonstrated with the
code posted.

Good luck !

Regards

On Sep 25, 12:45 am, limtc <[email protected]> wrote:
> 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();
>         invalidate(); // this will call the onDraw and pass in the
> canvas
>     }
>
> so I replace invalidate() by draw(canvas)?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to