how to access UI element values in layout.filename
I have made a custom class extending Preferences. I have used that custom class in a XML layout file and need to access the values there. part of my layout file:
<MyCustomClass
android:id="@+id/custom01"
android:title="ineedthistext" />
How can I retrieve "ineedthistext" as a s开发者_如何学Ctring?
Via the class constructor:
public MyCustomClass(Context context, AttributeSet attrs) {
...
// Get an attribute
X var = attrs.getX(...);
}
精彩评论