tags:

views:

73

answers:

1

Hello, I'm working on a soundboard, however I've got a problem when it come to drag the finger over the screen to play the sounds for the buttons I drag the finger over.

Button Button3 = (Button)findViewById(R.id.button03);
Button3.setOnTouchListener(new OnTouchListener() {
            @Override
            public boolean onTouch(View v, MotionEvent event) {
                if(event.getAction() == MotionEvent.ACTION_DOWN){
                    mp.playSound(3);
                }
            return false;
            }
        });

Do anyone know how I can detect when a finger enter a button and not click the button? Thanks :)

A: 

Look into onTouchEvent

public boolean onTouchEvent (MotionEvent event)

Since: API Level 1
Implement this method to handle touch screen motion events.
Parameters
event - The motion event.
Returns
True - if the event was handled, false otherwise.

Pentium10
I've looked into it again and came up with the idea that I detect where the finger is and if the fingers cordinates enter one of the buttons cordinates the sound will come, I going to test it as soon as possible.
Normano