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 or use it to set
the wallpaper.

Regards

On Sep 23, 1:03 pm, limtc <[email protected]> wrote:
> Hi,
>
> I am doing a painting program (KIds Paint - you can find in Android
> Market) and I have a lot of requests to save the content on disk or to
> wallpaper. I have been searching around but cannot find solution.
>
> My guess is that I probably wanted to get the bitmap from the canvas,
> but I can't find ways to get it. Then I try to set an empty bitmap
> into the canvas and draw on the canvas, and save the bitmap... but I
> got an empty bitmap.
>
> Please help! Thanks. Here's my codes:
>
> public class KidsPaintView extends View {
>         Bitmap bitmap = null;
> ...
>
>  protected void onDraw(Canvas canvas) {
>         if (bitmap == null) {
>             bitmap = Bitmap.createBitmap(width, height,
> Bitmap.Config.ARGB_8888);
>             canvas.setBitmap(bitmap);
>         }
>
>   ... // do painting on canvas
>   }
>
> }
>
> Then in my main code I try to retrieve the bitmap and save it as
> wallpaper:
>
> Bitmap bitmap = view.bitmap;
>
> try { setWallpaper(bitmap); }
> catch (IOException e) { e.printStackTrace(); }
>
> But all I got is a black wallpaper.
--~--~---------~--~----~------------~-------~--~----~
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