Remove selected item in new selection on spinner

0

Hello, I would like to remove an item already selected in the android spinner.

Example:

ItemA
ItemB -> SELECIONADO
ItemC
ItemD

Since ItemB is selected I would not want it to appear in the list when I was to select it again in Spinner. Example:

ItemA
ItemC
ItemD

How could I be doing?

I've already searched Google and found nothing about it, not even in the OS.

Thank you.

    
asked by anonymous 03.11.2016 / 19:00

1 answer

0

First get the desired item from Spinner :

int pos = 0;
object item = m_adapterForSpinner.getitem(posicao);

After getting the object, remove the item from adapter from Spinner :

m_adapterForSpinner.remove((CharSequence) item);

Finally determine adapter again:

spinner.setAdapter(m_adapterForSpinner);
    
03.11.2016 / 19:04