Code example for TimeAnimator

Methods: setTimeListener

0
                nv.x = (randfrange(0, boardWidth));
                nv.y = (randfrange(0, boardHeight));
            } 
 
            if (mAnim != null) {
                mAnim.cancel();
            } 
            mAnim = new TimeAnimator();
            mAnim.setTimeListener(new TimeAnimator.TimeListener() {
                private long lastPrint = 0;
                public void onTimeUpdate(TimeAnimator animation, long totalTime, long deltaTime) {
                    if (DEBUG && totalTime - lastPrint > 5000) {
                        lastPrint = totalTime;
                        for (int i=0; i<getChildCount(); i++) {
                            android.util.Log.d("BeanBag", "bean " + i + ": " + getChildAt(i));
                        } 
                    } 
 
                    for (int i=0; i<getChildCount(); i++) {
                        View v = getChildAt(i);
                        if (!(v instanceof Bean)) continue;