문제

I'm creating an MP3 player and want a dual Next Song / Fast Forward button. So if this button is pressed it will move on to the next song, and if it is held down it will fast forward through the current song.

I can get the Next Song working using a OnClickListener...

private OnClickListener mSkipForwardListener = new OnClickListener() {
    public void onClick(View v)
    {
        mPlayerService.forwardASong();
    }
};

...but how do I get the fast forward functionality ? I tried OnLongClickListener but that only fires once.

private OnLongClickListener mFastForwardListener = new OnLongClickListener() {
    @Override
    public boolean onLongClick(View v) {
        mPlayerService.fastForward();
        return true;
    }
};

And onTouch only seems to fire once on the key.down and key.up.

private OnTouchListener mFastForwardListener = new OnTouchListener() {

    @Override
    public boolean onTouch(View v, MotionEvent event) {
        mPlayerService.fastForward();
        return true;
    }
};

Any help, much appreciated, M.

올바른 솔루션이 없습니다

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top