Autore Topic: Asynctask multipli  (Letto 385 volte)

Offline elia_90

  • Nuovo arrivato
  • *
  • Post: 27
  • Fletto i muscoli e sono nel vuoto -.-
  • Respect: 0
    • Mostra profilo
  • Sistema operativo:
    Windows 8, Mac OS X 10.8
Asynctask multipli
« il: 31 Luglio 2013, 14:07:16 CEST »
ciao a tutti,

volevo chiedervi se Android po' e limitazioni al lancio di Asynctask multipli oppure ne posso lanciare 3 in cascata, uno dietro l'altro.

Offline aw4y

  • Utente junior
  • **
  • Post: 59
  • Respect: +6
    • Mostra profilo
  • Dispositivo Android:
    samsung i5500
  • Sistema operativo:
Re:Asynctask multipli
« Risposta #1 il: 31 Luglio 2013, 14:20:07 CEST »
i comportamenti sono diversi, dipende dalla versione di android:

Before Donut:
The first versions of AsyncTask.execute() let all tasks execute serially., Hence, before a task can execute, all the previous tasks have to be finished. The problem with this approach is that tasks delayed each other and the throughput could be bad when many long running tasks were executed with the AsyncTask.

From Donut to Gingerbread:
To improve throughput the behavior of the AsyncTask was changed so that each task was executed on a separate thread. The problem with this was that many users had relied on the sequential behavior and now suddenly started to encounter concurrency issues. Even the Android platform suffered from this internally.

Honeycomb and onwards:
Execution was switched back to the sequential implementation and another method executeOnExecutor(Executor) was added if parallel execution was needed.