If you can only see one circle, perhaps the value of "numCircles" is 1?

Or the values of x, y, r and k are wrong, and the circles are
positioned off-screen?

-- Kostya

2011/8/1 Y <[email protected]>:
> Thanks, Kostya! I followed your suggestions but I can only see one
> circle. I'm adding these circles to a LinearLayout in a View in which
> all the elements are added programmatically. This View is a child of a
> ViewFlipper. Every time the View flips to the next one, the circles
> disappear. Any suggestions on how to solve these problems?
>
> Thanks,
> Y
>
> On Aug 1, 2:28 pm, Kostya Vasilyev <[email protected]> wrote:
>> Call super.onDraw() first thing in your method, just once.
>>
>> And don't call invalidate(), as that would cause another redraw, and
>> another, and another..... at some point the value of "k" will increase
>> to place the circles beyond the right edge of the screen (you will want
>> to reset "k" somewhere, possibly right here inside onDraw).
>>
>> -- Kostya
>>
>> 01.08.2011 22:20, Y пишет:
>>
>> >    protected void onDraw(Canvas canvas) {
>>
>> >            for (int i = 0; i<  numOfCircles; i++) {
>> >                    super.onDraw(canvas);
>> >                    k = k + 10;
>> >                    canvas.drawCircle(x + k, y, r, gPaint);
>> >                    invalidate();
>> >            }
>> >       }
>>
>> --
>> Kostya Vasilyev
>
> --
> 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

-- 
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