Android AsyncTask: what is difference between execute() and get()? -


should write smth that

return task.exec(session, state).get(json_timeout, timeunit.milliseconds); 

or can this

task.exec(session, state, result); return result; 

a have read documentation found, failed find answer. bad...

do not use get(). block ui thread until asynctask finishes execution no longer makes asynchronous.

use execute , invoke asynctask

new task().exec(session, state, result); 

also can pass params constructor of asynctask or doinbackground()

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

public final result ()

added in api level 3 waits if necessary computation complete, , retrieves result. 

you can make asynctask inner class of activity class , update ui in onpostexecute.

if asynctask in different file can use interface.

how return boolean asynctask?


Comments

Popular posts from this blog

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

html - How to style widget with post count different than without post count -

url rewriting - How to redirect a http POST with urlrewritefilter -