@Target(value=METHOD) @Retention(value=CLASS) public @interface OnItemSelected
OnItemSelectedListener
on the view for each
ID specified.
@OnItemSelected(R.id.example_list) void onItemSelected(int position) {
Toast.makeText(this, "Selected position " + position + "!", Toast.LENGTH_SHORT).show();
}
Any number of parameters from
onItemSelected
may be used on the method.
To bind to methods other than onItemSelected
, specify a different callback
.
@OnItemSelected(value = R.id.example_list, callback = NOTHING_SELECTED)
void onNothingSelected() {
Toast.makeText(this, "Nothing selected!", Toast.LENGTH_SHORT).show();
}
AdapterView.OnItemSelectedListener
Modifier and Type | Optional Element and Description |
---|---|
OnItemSelected.Callback |
callback
Listener callback to which the method will be bound.
|
int[] |
value
View IDs to which the method will be bound.
|
public abstract int[] value
public abstract OnItemSelected.Callback callback
Copyright © 2013-2015. All Rights Reserved.