Get button coordinates and detect if finger is over them – Android

package com.example.touch; import android.app.Activity; import android.os.Bundle; import android.view.MotionEvent; import android.view.View; import android.widget.Button; import android.widget.RelativeLayout; import android.widget.TextView; public class MainActivity extends Activity { Button b1, b2, b3, b4; int b1x1, b1x2, b1y1, b1y2; private TextView xcordview; private TextView ycordview; private TextView buttonIndicator; private RelativeLayout touchview; private static int defaultStates[]; private Button mLastButton; private final static int[] … Read more