Skip to content Skip to sidebar Skip to footer

How To Speed Up The Forward/rewind Process When Button Pressed Continuously

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 fo

Solution 1:

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
        }
    }
};

Post a Comment for "How To Speed Up The Forward/rewind Process When Button Pressed Continuously"