Great! How can I assist you in translating text? What language do you need to translate from and to?
// some code #1
Thread t = new Thread("Thread1") {
@Override
public void run() {
// some code #2
runOnUiThread(new Runnable() {
public void run() {
// some code #3 (that needs to be ran in UI thread)
}
});
}
};
t.start();
vs.
AsyncTask:
onPreExecute() {
// some code #1
}
doInBackground() {
// some code #2
}
onPostExecute() {
// some code #3
}
有哪些优缺点?
编辑:
我不想要像“代码更易于查看”,“方便开发者”等回答。 我实际上正在寻找幕后的技术差异。
例如,Paul Nikonowicz下面的答案就是我想看到的答案。(但AsyncTask行为相同)