Guest User

Untitled

a guest
Sep 19th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. val handler = Handler(Looper.getMainLooper())
  2. val runnable = object : Runnable {
  3. override fun run() {
  4. if (countProgress.progress > 0) {
  5. val new_time = countProgress.progress.toInt() - 1
  6. timeLabel.text = "$new_time segundos"
  7. countProgress.progress = new_time
  8. }
  9.  
  10. handler.postDelayed(this, 1000)
  11. }
  12. }
  13.  
  14. playCount.setOnClickListener() {
  15. handler.postDelayed(runnable, 1000)
  16. }
  17. pauseCount.setOnClickListener() {
  18. handler.removeCallbacks(runnable)
  19. }
Add Comment
Please, Sign In to add comment