2

How is it possible to get "getText()" from child of type TextView within a custom ViewGroup at runtime?

Ajay
  • 1,255
  • 1
  • 17
  • 30

1 Answers1

6
((TextView)viewGroup.getChildAt(indexOfTextView)).getText();

Where viewGroup is the ViewGroup containing the TextView and indexOfTextView is the index in that group.

Make sure to cast the view returned from the getChildAt method to A TextView before calling getText().

ViewGroup Docs for getChildAt() http://developer.android.com/reference/android/view/ViewGroup.html

Spaceman Spiff
  • 934
  • 1
  • 14
  • 32