Issue
I have a TextView
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/str_text"
android:textAppearance="?android:attr/textAppearanceMedium" />
If i have this..
TextView txt = (TextView) getView().findViewById(R.id.textView1);
How can i get this
"str_text"
Solution
You can't. You can go from ID to the value, but not the reverse. To make it more clear why not, imagine if you had multiple string resources with the same value.
The resource ID isn't stored after inflating the View.
Answered By - Kevin Coppock
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.