2014. 12. 3. 16:37

아래와 같은 솔루션을 이용하자.


setonItemselectedListener 전에  setselection(position, false); 를 넣으면 된다.



The use of Runnables is completely incorrect.

Use setSelection(position, false); in the initial selection before setOnItemSelectedListener(listener)

This way you set your selection with no animation which causes the on item selected listener to be called. But the listener is null so nothing is run. Then your listener is assigned.

So follow this exact sequence:

Spinner s = (Spinner)Util.findViewById(view, R.id.sound, R.id.spinner);
s.setAdapter(adapter);
s.setSelection(position, false);
s.setOnItemSelectedListener(listener);


Posted by hoonihoon

댓글을 달아 주세요