How to get the text of view in onintercepttouchevent
<p>i have an application code which consists of a relative layout, and a table and inside it a set of buttons are there. i need to handle onintercepttouchevent, what i want to do is i want to retrieve the text of the button which was clicked and use its text to set it in a string. but i want to know how to implement the onintercepttouchevent and ontouchevent methods for each and every button and the parent layout. i want to know how to retrieve the text of the button and how to handle various actions like DOWN, MOVE and UP events. so please give me a clear example of how to achieve this. how to implement the onintercepttouchevent method with an example. </p>

<p>here is my code</p>

<p>public class ContactActivity extends Activity 
implements OnInitListener,OnTouchListener</p>

<p>{</p>

<pre><code>/** Called when the activity is first created. */
Handler mhandler = new Handler();
Button mybtn[] = new Button[10];
// int[] mybtn1 = new int[] {R.id.btn0,R.id.btn1,R.id.btn2,R.id.btn11};

Button select_btn, home_btn;
View l;
EditText et;
Bundle b;
Intent in;
int var = 0;
int pass = 1;
int quit = 1;
int current = 0;
boolean status = false;
private int MY_DATA_CHECKCODE = 0;
private TextToSpeech tts = null;
Runnable mUpdateTimeTask = null;

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    // select_btn = (Button) findViewById(R.id.ok);
    // home_btn = (Button) findViewById(R.id.home);
    et = (EditText) findViewById(R.id.entry);
    et.setText("", TextView.BufferType.EDITABLE);
    l = (View) findViewById(R.id.main_layout);
    b = new Bundle();


    for (int i = 0; i &lt; mybtn.length; i++) {
        String btnid = "btn" + i;
        int resid = getResources().getIdentifier(btnid, "id",
                getPackageName());
        mybtn[i] = (Button) findViewById(resid);
        mybtn[i].setOnTouchListener(this);

    }


}

public boolean onInterceptTouchEvent(MotionEvent ev) {
    final int action = ev.getAction();

    // final float x = ev.getX();

    switch (action) {

    case MotionEvent.ACTION_DOWN:

        // Remember each down event,
        // as it is needed in startDragging above
        // mLastMotionX = x;
        status = false;
        break;

    case MotionEvent.ACTION_MOVE:
        status = true;
        break;
    case MotionEvent.ACTION_UP:
        status = false;
        break;
    }
    // Whilst dragging, we return true in order to dispatch
    // the MotionEvent to our onTouchEvent method below.
    // return mIsDragging;
    return status;
}

public boolean onTouchEvent(MotionEvent ev) {

    if (!status) {
        // Not in dragging mode, so no tyaction taken
        return super.onTouchEvent(ev);
    }

    final int action = ev.getAction();
    // float x = ev.getX();

    switch (action) {

    case MotionEvent.ACTION_DOWN:
        // et.setText("down android" + s, TextView.BufferType.EDITABLE);
        break;

    case MotionEvent.ACTION_MOVE:
        // Move the object.
        // doDrag(x);
        // Call back to user
        // callMoveCallback(x);
        break;

    case MotionEvent.ACTION_CANCEL:
        break;
    case MotionEvent.ACTION_UP:
        // stopDragging(x);
        // et.setText("down android" + s, TextView.BufferType.EDITABLE);
        break;
    }
    return true;
}
</code></pre>

<p>}</p>

<p>but i dont know , how to implement the above two methods for each and every Button and the parent layout. i also want to know how to retrieve the text of the button, which is touched. i have tried the ontouch(MotionEvent, View) method. can i do it using above two mehtods. how to do it?. 
and one more thing
 View l = (View)findViewById(R.id.main_layout);
is it fine? how to retireve the layouts in android. inside it i have table and inside it i have buttons , how to handle them? please throw some light on this.</p>
