I have custom attributes set in attrs.xml name custom_values, one of which is named stageNumber. I have a Button with this custom value defined e.g. custom:stageNumber="2" with an onClick handler titled goToStage. In the goToStage method I need to obtain the value of stageNumber. I am unable to fetch the AttributeSet required by the method obtainStyledAttributes.
public void goToStage(View view) {
AttributeSet attrs = ???;
TypedArray ta = view.getContext().obtainStyledAttributes(attrs, R.attr.custom_values);
int stageNumber = ta.getInt(R.styleable.custom_values_stageNumber, 0);
// do something with stageNumber
}
Any suggestions to resolve this?