Get text inside a button
6 answers
Try saving all your lines in strings.xml (rather than hard-coded them everywhere)
<Button android:id="@+id/button1" android:text="@string/button1_label">
In the strings.xml file:
<string name="button1_label">blah blah</string>
Then you can easily get the text using:
Context.getString(R.string.button1_label)
You can find out more here.
+1