根据对以上单线程模式的描述,要想保证程序界面的响应能力,关键是不能阻塞UI线程。
Because of the single thread model described above, it's vital to the responsiveness of your application's UI that you do not block the UI thread.
但不幸的是,上面的代码违背了UI线程的单线程模式:Android UI toolkit不是线程安全的,所以对UI的操作都应该在主ui线程中进行。
Unfortunately, it violates the single-threaded model for the UI: the Android UI toolkit is not thread-safe and must always be manipulated on the UI thread.
基于新的执行注释,用户能清楚地规定其网络处理器中的回调函数应该以单线程的模式执行还是多线程的模式执行。
Based on the new execution annotations the user can define if the call back methods of his network handler should be executed in single threaded mode or multithreaded mode.
应用推荐