0

I want to increase the forward/rewind speed if the button is pressed continuously.

I created my customized media controller from here.

What would be the good way to speed up the forward/rewind process?

I got some idea form here. Finally I implemented it too but the touch event worked successfully in my emulator or and android mobile too but didn't worked for android stb. Other solutions rather than using it would be appreciated.

Community
  • 1
  • 1
A_rmas
  • 784
  • 2
  • 10
  • 26

1 Answers1

2

How about you monitor the MotionEvent.ACTION_DOWN and MotionEvent.ACTION_UP and see how long the button is pressed.

button.setOnTouchListener(new OnTouchListener() {
    @Override
    public boolean onTouch(View v, MotionEvent event) {
        if(event.getAction() == MotionEvent.ACTION_DOWN) {
            // the button is down monitor time to see how long it is down or anything you want
        } else if (event.getAction() == MotionEvent.ACTION_UP) {
            // the button is up reset your timer
        }
    }
};
meadhikari
  • 971
  • 3
  • 13
  • 27