Question

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.

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top