Overriding Method onProgressChanged of Interface OnSeekBarChangeListener

Lines 102–119 implement interface OnSeekBarChangeListener’s methods. Method onProgressChanged is called whenever the SeekBar’s thumb position changes. Line 107 calculates customPercent using the method’s progress parameter—an int representing the SeekBar’s thumb position. We divide this by 100.0 to get the custom percentage. Line 108 calls method updateCustom to recalculate and display the custom tip and total.

Get Android™ How to Program, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.