Code example for Scroller

Methods: computeScrollOffset, forceFinished, getCurrY, getFinalY, isFinished

0
  } 
 
  // animation handler 
  private Handler animationHandler = new Handler() {
    public void handleMessage(Message msg) { 
      scroller.computeScrollOffset(); 
      int currY = scroller.getCurrY(); 
      int delta = lastScrollY - currY; 
      lastScrollY = currY; 
      if (delta != 0) { 
        listener.onScroll(delta); 
      } 
 
      // scrolling is not finished when it 
      // comes to final Y 
      // so, finish it manually 
      if (Math.abs(currY - scroller.getFinalY()) < MIN_DELTA_FOR_SCROLLING) { 
        currY = scroller.getFinalY(); 
        scroller.forceFinished(true); 
      } 
      if (!scroller.isFinished()) { 
        animationHandler.sendEmptyMessage(msg.what); 
      } else if (msg.what == MESSAGE_SCROLL) { 
        justify(); 
      } else { 
        finishScrolling();