我想知道在android主线程中编写循环大约400-500次的for循环是否是一个好习惯,或者我应该去另一个线程。提前致谢。
问问题
209 次
1 回答
1
Since you say the loop is processing several hundred coordinates, it should definitely be an AsyncTask
or a background thread. Even if the user cannot interact with the UI in that period, this will allow you to show a spinner or dialog for that duration. Further, if the UI thread is unresponsive for more than a certain amount of time, the OS considers the app to have crashed, and gives the user the 'This app has stopped responding' dialog box.
于 2013-05-01T04:51:48.987 回答