0
我要當的AsyncTask完成知道,這樣我可以更新UI。的Android使用的AsyncTask更新UI
任何人可以幫助????謝謝!!!
public String[] getinfo(int id) {
String[] QueueNo = null;
try {
new DLfromServer().execute("url link"); // this is the asynctask
// want to do stuff here after the asynctask is completed
// actually I want to return a string result after the task is finished....
}
} catch (JSONException e) {
Log.e("GetJSON", "Err:", e);
}
return QueueNo;
}
你能介紹給例子如何在線程中調用AsyncTask.get()? Asynctask實際上是一個類,我從一個片段調用它......這是否意味着它不在主線程上? – 2013-03-18 05:10:36
@ user1702061:只需創建一個線程像Java和移動'字符串str_result =新DLfromServer()執行( 「URL鏈接」)獲得();'線程內運行方法。 – 2013-03-18 05:12:41