I have the following code for spinner click event :When the async task is included in that, I cant get the position of item clicked
spinner2.setOnItemSelectedListener(new OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parent, View arg1, int pos, long arg3) {
int index = parent.getSelectedItemPosition();
Downloadsuborderpackage task = new Downloadsuborderpackage();
task.execute(new String[] { "" });
}
@Override
public void onNothingSelected(AdapterView<?> arg0) {
}
});
But when I execute the async task Downloadsuborderpackage I can’t get the item position.
And if that async task is commented I can get the selected item position.
Why ?
Write below code line to get selected item index
instead of
it will solve your problem.