A pause isn't enough.  All drawing is double-buffered.  You will never see
what you have drawn until the entire drawing is complete.  If the code is in
the view hierarchy, this means nothing is drawn until everything returns
from its onDraw() call.  To do sequential frames, after the first one you
need to call invalidate() to schedule the draw of the next one and then wait
for the following onDraw() to call that next frame.

Of course, you don't want to just call invalidate() inside of onDraw() or
else your app will set there continually drawing as fast it can and draining
the battery.  This is why you typically use Handler.postDelayed() or
sendDelayed() to schedule the invalidate() calls at the rate you want to
animate.

On Fri, Jan 28, 2011 at 2:44 PM, Kumar Bibek <coomar....@gmail.com> wrote:

> Run a thread. Put a sleep and then change your Bitmap when the thread wakes
> up. Loop it 3 times. :)
>
>
> Kumar Bibek
> http://techdroid.kbeanie.com
> http://www.kbeanie.com
>
>
>
>
> On Sat, Jan 29, 2011 at 4:13 AM, android777 <anilreddy...@gmail.com>wrote:
>
>> Sorry to ask such a silly question, but How can I put pause? Is it in
>> canvas class or a sleep?
>>
>> On Jan 28, 4:36 pm, "Tommy" <droi...@gmail.com> wrote:
>> > The drawing is probably happening to fast for you to notice. Put a pause
>> in
>> > there for like ½ a second (500 ms)
>> >
>> > From: android-developers@googlegroups.com
>> > [mailto:android-developers@googlegroups.com] On Behalf Of Kumar Bibek
>> > Sent: Friday, January 28, 2011 5:32 PM
>> > To: android-developers@googlegroups.com
>> > Subject: Re: [android-developers] Draw bitmaps one after other using
>> canvas
>> >
>> > What are you trying to achieve? If you want a pause between the switch,
>> you
>> > have to set it in your code, else, you wouldn't notice the transition.
>> >
>> > Kumar Bibekhttp://techdroid.kbeanie.comhttp://www.kbeanie.com
>> >
>> > On Sat, Jan 29, 2011 at 3:55 AM, android777 <anilreddy...@gmail.com>
>> wrote:
>> >
>> > How can I draw bitmaps one after other. I was trying to draw three
>> > bitmaps as follows.
>> >
>> > Bitmap flower =
>> > BitmapFactory.decodeResource(getResources(),R.drawable.flowers1);
>> >
>> >                canvas.drawColor(Color.BLACK);
>> >                canvas.drawBitmap(kangoo, 0, 0, null);
>> > flower =
>> > BitmapFactory.decodeResource(getResources(),R.drawable.flowers2);
>> >
>> >                canvas.drawColor(Color.BLACK);
>> >                canvas.drawBitmap(kangoo, 0, 0, null);
>> > flower =
>> > BitmapFactory.decodeResource(getResources(),R.drawable.flowers3);
>> >
>> >                canvas.drawColor(Color.BLACK);
>> >                canvas.drawBitmap(kangoo, 0, 0, null);
>> >
>> > But it draws only the last image. What is the problem? How can I solve
>> > it?
>> >
>> > --
>> > You received this message because you are subscribed to the Google
>> > Groups "Android Developers" group.
>> > To post to this group, send email to
>> android-developers@googlegroups.com
>> > To unsubscribe from this group, send email to
>> > android-developers+unsubscr...@googlegroups.com<android-developers%2bunsubscr...@googlegroups.com>
>> > <mailto:android-developers%2bunsubscr...@googlegroups.com<android-developers%252bunsubscr...@googlegroups.com>
>> >
>> > For more options, visit this group athttp://
>> groups.google.com/group/android-developers?hl=en
>> >
>> > --
>> > You received this message because you are subscribed to the Google
>> > Groups "Android Developers" group.
>> > To post to this group, send email to
>> android-developers@googlegroups.com
>> > To unsubscribe from this group, send email to
>> > android-developers+unsubscr...@googlegroups.com<android-developers%2bunsubscr...@googlegroups.com>
>> > For more options, visit this group athttp://
>> groups.google.com/group/android-developers?hl=en
>>
>> --
>> You received this message because you are subscribed to the Google
>> Groups "Android Developers" group.
>> To post to this group, send email to android-developers@googlegroups.com
>> To unsubscribe from this group, send email to
>> android-developers+unsubscr...@googlegroups.com<android-developers%2bunsubscr...@googlegroups.com>
>> For more options, visit this group at
>> http://groups.google.com/group/android-developers?hl=en
>
>
>  --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com<android-developers%2bunsubscr...@googlegroups.com>
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>



-- 
Dianne Hackborn
Android framework engineer
hack...@android.com

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to