onSelectedItemClick
antoine1003 opened this issue · comments
Hey,
Is there anyway to create an even when the user click on the selected item?
Thanks
I find a trick for the ones who are looking for the same thing.
- Add
private int position = -1;
as a global variable in the .java of your view.
loopView.setListener(new OnItemSelectedListener() {
@Override
public void onItemSelected(int index) {
if(position == index){
Toast.makeText(MainActivity.this, "item " + position + " name:" + list.get(position).toString(), Toast.LENGTH_SHORT).show();
}
else {
position = index;
}
}
});
In that way, you'll have a onClickListenner
thanks a lot,i think this problem for a forenoon.