Hi all! so currently i have an activity that laucnhes an async task from 
inside the spinner onItemSelected method with the select int year value:

spinYears.setOnItemSelectedListener(
 new OnItemSelectedListener() {

@Override
public void onItemSelected(AdapterView<?> item, View arg1,
int arg2, long arg3) {

yearSelected=(Integer) item.getSelectedItem(); 
doAsyncTask();

}

@Override
public void onNothingSelected(AdapterView<?> arg0) {
// TODO Auto-generated method stub

}});

*here's the doAsyncTask method:*

/**
 * do asynctask for background work
 */
public void doAsyncTask(){
//get task back in case of rotation
task= (QuadrosMobileActivityTask<?, ?, ?>)getLastNonConfigurationInstance();

if(task==null){ 
 task=new PeriodoFeriasDbAsyncTask(this);
                ((PeriodoFeriasDbAsyncTask)task).execute(yearSelected);
}else{
task.attach(this);
}
}


if i rotate the phone the task runs again, but if i put the doAsyncTask() 
method call outside of the listener it works as it should.....any reason 
for this?why would calling a task inside the spinner listener be different?

regards,


-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to