Code example for Scroller

     * Sets up the scroller and touch/fling sensitivity parameters for the pager. 
    private void init() { 
        mScroller = new Scroller(getContext());
        // Calculate the density-dependent snap velocity in pixels 
        DisplayMetrics displayMetrics = new DisplayMetrics();
        ((WindowManager) getContext().getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay()
        mDensityAdjustedSnapVelocity =
                (int) (displayMetrics.density * SNAP_VELOCITY_DIP_PER_SECOND);
        final ViewConfiguration configuration = ViewConfiguration.get(getContext());
        mTouchSlop = configuration.getScaledTouchSlop();
        mMaximumVelocity = configuration.getScaledMaximumFlingVelocity();
Experience pair programming with AI  Get Codota for Java