Moving circles in android
<p>I have a task. It's to draw some (more than one) circles moving around the screen. They must start moving after click on them. I have the code only for one circle. Give me the way how to do this task, for example, 5 circles. Thanks in advance!</p>

<pre><code>public class MainActivity extends Activity {

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(new MyView(this));
    }

    class MyView extends View {
        //public    Paint c;
        public  Paint p;

        private static final int RADIUS = 46;

        private int centerX;
        private int centerY;
        private int speedX = 50;
        private int speedY = 40;
        //private Paint paint; // Создай его где-нибудь там в конструкторе


        public MyView(Context context) {
            super(context);
            p = new Paint();
            p.setColor(Color.GREEN);
        }

        @Override
        protected void onSizeChanged(int w, int h, int oldW, int oldH) {
            centerX = w / 2;
            centerY = h / 2;
        }

        protected void onDraw(Canvas c) {
            int w = getWidth();
            int h = getHeight();
            centerX += speedX;
            centerY += speedY;
            int rightLimit = w - RADIUS;
            int bottomLimit = h - RADIUS;

            if (centerX &gt;= rightLimit) {
                centerX = rightLimit;
                speedX *= -1;
            }
            if (centerX &lt;= RADIUS) {
                centerX = RADIUS;
                speedX *= -1;
            }
            if (centerY &gt;= bottomLimit) {
                centerY = bottomLimit;
                speedY *= -1;
            }
            if (centerY &lt;= RADIUS) {
                centerY = RADIUS;
                speedY *= -1;
            }

            c.drawCircle(centerX, centerY, RADIUS, p);
            postInvalidateDelayed(200);  
        }
    }
}
</code></pre>
