Reputation: 777
i have spinner that i create with my custom adapter and i want to select specify item in load spinner and do not use setSelection method for select specify item because i use AsyncTask for load data to spinner. write this code in adapter :
spinner.setSelection(myposition);
this method work but when click on spinner and chose an item, dropDown not hidden.
my question is how can i select item when i creating the items spinner. i means how can i select item in the getView method in adapter? please help me.
Upvotes: 0
Views: 290
Reputation: 3527
whe loading data in asyncTask (e.g for loop to fill arrayList) you can note the position you need to select and after adding all the data to adapter call the select method on spinner within same ayncTask (postExecute
).
And why don't your drop down hiding are you overriding the click function of spinner ?
Upvotes: 1