getSelectedItemPosition not working

I receive always -1, 
With this change, it works for me. Probably you have a better solution