Register two touchEvents on two dfferent Button android
<p>the problem I have is that I have two different Button, covering all the layout:</p>

<pre><code>&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/relative"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" &gt;

&lt;LinearLayout
    android:id="@+id/linear"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="horizontal" &gt;

    &lt;Button
        android:id="@+id/botonoui"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_weight="0.5"
        android:background="@drawable/green_buton"
        android:text="OUI"
        android:textColor="#FFF"
        android:textSize="30sp"
        android:textStyle="bold" /&gt;

    &lt;Button
        android:id="@+id/botonno"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_weight="0.5"
        android:background="@drawable/red_button"
        android:text="NON"
        android:textColor="#FFF"
        android:textSize="30sp"
        android:textStyle="bold" /&gt;
&lt;/LinearLayout&gt;&lt;/RelativeLayout&gt;
</code></pre>

<p>Well, this is my Activity:</p>

<p>public class OuiNoActivity extends Activity {</p>

<pre><code>public static final String TAG = "OuiNonActivity";
public static final String SENSIBILITE = "sensibilite";

private SharedPreferences preferences;
private SharedPreferences.Editor prefEditor;

private Button ouiButton = null;
private Button noButton = null;

private MediaPlayer mp = null;
private boolean reproduciendo = false;

private float sensibleDistance = 100.0f;

private float ouiX = 0.0f;
private float ouiY = 0.0f;
private float nonX = 0.0f;
private float nonY = 0.0f;

private static Context context = null;

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    context = this;

    setContentView(R.layout.main_new);

    preferences = getSharedPreferences("preference", MODE_PRIVATE);
    sensibleDistance = preferences.getFloat(SENSIBILITE, 100.0f);

    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);

    ouiButton = (Button) findViewById(R.id.botonoui);
    ouiButton.setOnTouchListener(new OnTouchListener() {
        @Override
        public boolean onTouch(View v, MotionEvent event) {
            if(event.getAction()==MotionEvent.ACTION_MOVE){
                if(ouiX != 0.0f | ouiY != 0.0f){
                    float distanceX = Math.abs(ouiX - event.getX());
                    float distanceY = Math.abs(ouiY - event.getY());
                    if(distanceX &gt; sensibleDistance | distanceY &gt; sensibleDistance){
                        playSoundAndIluminateScreen(true);
                    }

                } else{
                    ouiX = event.getX();
                    ouiY = event.getY();
                }
            }
            return true;
        }
    });

    noButton = (Button) findViewById(R.id.botonno);
    noButton.setOnTouchListener(new OnTouchListener() {
        @Override
        public boolean onTouch(View v, MotionEvent event) {
            if(event.getAction()==MotionEvent.ACTION_MOVE){
                if(nonX != 0.0f | nonY != 0.0f){
                    float distanceX = Math.abs(nonX - event.getX());
                    float distanceY = Math.abs(nonY - event.getY());
                    if(distanceX &gt; sensibleDistance | distanceY &gt; sensibleDistance){
                        playSoundAndIluminateScreen(false);
                    }

                } else{
                    nonX = event.getX();
                    nonY = event.getY();
                }
            }
            return true;
        }
    });


    setVolumeControlStream(AudioManager.STREAM_MUSIC);

}


/**
 * Method which play the sound according to the boolean received
 * @param ouiOrNon boolean. true means "oui" was moved, false means "non" was moved
 */
public void playSoundAndIluminateScreen(boolean ouiOrNon){
    try{
        if (!reproduciendo) {
            if(ouiOrNon){
                ouiButton.setBackgroundResource(R.drawable.green);
                mp = MediaPlayer.create(context, R.raw.oui2);
            }else{
                noButton.setBackgroundResource(R.drawable.red);
                mp = MediaPlayer.create(context, R.raw.non2);
            }
            reproduciendo = true;
            mp.start();
            mp.setOnCompletionListener(new OnCompletionListener() {
                // @Override
                public void onCompletion(MediaPlayer arg0) {
                    reproduciendo = false;
                    noButton.setBackgroundResource(R.drawable.red_button);
                    ouiButton.setBackgroundResource(R.drawable.green_buton);
                    ouiX = 0.0f;
                    ouiY = 0.0f;
                    nonX = 0.0f;
                    nonY = 0.0f;
                }
            });
        }
    }catch(NullPointerException e){
        Log.e(TAG, e.getMessage());
    }

}
</code></pre>

<p>What I want is to be able to put two fingers at the same time(one on each Button), and to launch the method "playSoundsAndIluminateScreen(boolean)" everytime one of them is moving more than a given value(100.0f by default). When I first move one finger is ok, the method is launched correctly, but then, I scroll the other over the Button and the method is launched like if it was the first button.</p>

<p>This is working properly on a Samsung Galaxy SII with ICS, it is not working properly on a Samsung Galaxy S with Android 2.3.6, Samsung Galaxy Mini android 2.3.7 and a HTC Wildfire android 2.2.</p>

<p>I think it is cause the screen is not able to manager properly to touch events,
Anyone knows if I am right? or is there any problem on my code???</p>

<p>Thanks a lot!</p>
