tags:

views:

24

answers:

0

I apologize for asking a question that's already been asked, but I see that someone provided a possible solution to allow multiple imagebuttons to be pressed at the same time: http://stackoverflow.com/questions/2528160/multiple-button-presses-for-android-2-x

His code is as follows:

@Override

public boolean onTouchEvent (MotionEvent event) {

if (event.getAction()==MotionEvent.ACTION_UP) {
    // reset all buttons
    ...
}
else {
    int count=event.getPointerCount(),vx1=-1,vy1=-1,vx2=-1,vy2=-1;
    if (count>=1) {
        vx1=(int)event.getX(0);
        vy1=(int)event.getY(0);
    }
    if (count>=2) {
        vx2=(int)event.getX(1);
        vy2=(int)event.getY(1);
    }
    ...
}
return true;

}

Do you think this would work? If so, how would I implement it with my existing code?:

ImageButton Button1 = (ImageButton)findViewById(R.id.sound); Button1.setOnTouchListener(new OnTouchListener() {

    public boolean onTouch(View v, MotionEvent event) {
        if (event.getAction() == MotionEvent.ACTION_DOWN ) {
            mSoundManager.playSound(1);
            return false;
        }

        return false;
    }
});

Any help is greatly appreciated. Thanks.