Code example for ShapeDrawable

Methods: draw, sleep

0
        /* NOTE: This is to demonstrate how you should NOT do!! */ 
        @Override 
        protected void onDraw(Canvas canvas) {
            if (maxSteps < MAX_STEPS) {
                canvas.save();
                drawable.draw(canvas);
                canvas.translate(5 * maxSteps, 0);
                maxSteps++;
                canvas.restore();
                try { 
                    Thread.sleep(100);
                } catch (InterruptedException e) {
                } 
                invalidate();
            } 
        } 
 
        /* NOTE: This is to demonstrate how you should NOT do!! */ 
        @Override 
        public boolean onTouch(View view, MotionEvent me) {
            this.maxSteps = 0;