Pav*_*kin 4 android android-asynctask
我应该写那样的smth吗?
return task.exec(session, state).get(json_timeout, TimeUnit.MILLISECONDS);
Run Code Online (Sandbox Code Playgroud)
或者我可以这样做
task.exec(session, state, result);
return result;
Run Code Online (Sandbox Code Playgroud)
A已经阅读了我找到的所有文档,但未能找到答案.我的错...
不要用get().它将阻止ui线程,直到asynctask完成执行,不再使它异步.
使用execute并调用asynctask
new task().exec(session, state, result);
Run Code Online (Sandbox Code Playgroud)
你也可以将params传递给asynctaskor或的构造函数doInbackground()
http://developer.android.com/reference/android/os/AsyncTask.html
public final Result get ()
Added in API level 3
Waits if necessary for the computation to complete, and then retrieves its result.
Run Code Online (Sandbox Code Playgroud)
您可以将asynctask作为活动类的内部类并更新ui onPostExecute.
如果asynctask在不同的文件中,那么您可以使用interface.
| 归档时间: |
|
| 查看次数: |
1146 次 |
| 最近记录: |