Only one Looper may be created per thread Error, Async Task

别来无恙 提交于 2019-12-06 14:48:22
Ashterothi

Looper has nothing to do with for loops. The Looper is the part of the Android system that controls the UI thread. There are several things that wont work without preparing the looper, but in general it is best to avoid Looper.prepare(); unless absolutely necessary. It is far better to use the async doInBackground to perform data processing or other longer operations, and then update the UI with onPostExecute and onProgressUpdate.

In short, unless you are using the UI in some way, you don't need to call the Looper. If you find yourself having to call the Looper, you probably need to restructure how your background threads are working.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!