7

I have two column in relative layout. both column have few button with text. I want to draw a line using finger which join the button. Take the example of "match the following"
like A ------------------- A.

Above things are done. Now i want to get the text of button from where user start drawing the line and end the line. In above case is "A".

Could any one please help me out.

enter image description here

I want to get the text with Orange circle when user start drawing the line from finger and then text of the green circle when user stop the line draw from finger. Text showing inside the circle are button only.

I am using onTouchEvent(MotionEvent event) for drawing line.

I hope now i am able to explain my requirement more

Thanks

itin
  • 430
  • 3
  • 9
  • 20

2 Answers2

7

For example, if the View contains text, use this:

( (TextView) view ).getText().toString();

where view is being cast to TextView.

Satan Pandeya
  • 3,747
  • 4
  • 27
  • 53
Moz
  • 109
  • 2
  • 10
1

Do you mean you want get the text display by your button in layout file ?

You can do this by a simple

button.getText();
lithos35
  • 250
  • 2
  • 9