how to speed up the forward/rewind process when button pressed continuously

牧云@^-^@ 提交于 2019-12-12 02:58:36

问题


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.


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


来源:https://stackoverflow.com/questions/25887794/how-to-speed-up-the-forward-rewind-process-when-button-pressed-continuously

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!