performance - Multitasking network operations android -


i want know best decision carrying out several network tasks simultaneously . scenario follows :- have several words on listview ( maximum 20 ). want search of these words simultaneously while displaying "loading" progress dialog on screen . , want operation complete fast possible .

i thinking 2 things :- i. spawning several asynctasks every request . ii. using service .

please , me make decision .

you can use executor running multitple tasks.

http://developer.android.com/reference/java/util/concurrent/executor.html.

also check executorservice in below link

http://developer.android.com/reference/java/util/concurrent/executorservice.html

an alternative asynctask robospice. runs asynchronously.canhandle multiple spice requests. updates ui on ui thread. more details check below link

https://github.com/octo-online/robospice

edit:

http://developer.android.com/reference/android/os/asynctask.html

check order of execution topic

quote above link

if want parallel execution, can invoke executeonexecutor(java.util.concurrent.executor, object[]) thread_pool_executor

starting honeycomb, tasks executed on single thread avoid common application errors caused parallel execution.


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -