开发者

asyntasks dependencies

开发者 https://www.devze.com 2023-03-01 07:28 出处:网络
I have an android program that have a asyntask. I would like that when these asyntask finalize depending of the result launch one asyntaskor other asyntask. I\'m tryng with these code but I think it w

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)..

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号