

If you populate a list in an async thread, it goes on the background thread and 99% it will finish after the listener is instantiated. This will add the items before the event listener is set and will not trigger it This appened to me also a couple of times, try calling your loadData() method before adding the setOnItemSelectedListener(.) I would like to know how I can trigger the event only when I manually select from the spinner.


The problem is that the event is triggered in the initialization of the spinner, which causes getArticlesB圜ategory to be called every time a new element is added. In my android app I have a spinner that I initialize with some categories public void loadData()īufferedReader in = new BufferedReader(new InputStreamReader(url.openStream())) įor (int i = 0 i parentView, View selectedItemView, int position, long void onNothingSelected(AdapterView adapterView)įinally I call loadData in onCreate loadData()
