asyntasks dependencies
I have an android program that have a asyntask. I would like that when these asyntask finalize depending of the result launch one asyntask or other asyntask. I'm tryng with these code but I think it works despite it doesnt shows me the progress dialog of the primary asyntask. When I comment the if statement shows me the progress dialog of the first asyntask. How could I do it? Why don't show the progress dialog 开发者_运维技巧of the first asyntask.
lanzaPing tarea = new lanzaPing();
tarea.execute(); //first asyntask
try {
if (tarea.get()){
Log.d(«PRUEBA», «El resultado es .... « + tarea.get());
new tareaWOL().execute();
}else
{
Log.d(«PRUEBA», «El resultado es .... « + tarea.get());
new tareaPing().execute();
}
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ExecutionException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Put the if-statement in the first AsyncTasks "onPostExecute"-method. That should work. (If that was what you were asking for)..
精彩评论