Skip to content Skip to sidebar Skip to footer

Play A Random Sound OnTouch

I'm trying to play a random sound onTouch event (currently working), but the sound is actually played twice onTouch event instead of once as intended. I'm assuming this is due to

Solution 1:

that is because both ACTION_DOWN and ACTION_UP are firing, implement on code only on one of them

    public boolean onTouchEvent(MotionEvent evt) 
    {
        switch (evt.getAction()) 
        {
            case MotionEvent.ACTION_DOWN: 
            break;
            case MotionEvent.ACTION_UP:
            break;
            default:
            break;
        }
        return true;
    }

Post a Comment for "Play A Random Sound OnTouch"