Android 书中的一些文字:
"However, starting with Android 3.0, synchronous operations can no longer be run directly from a UI thread. "
我认为在某个线程中运行的每个代码都是“同步操作” 那么,“同步操作”是什么意思呢?
Android运行时如何检测代码是“同步操作”
最佳答案
The reason why your application crashes on Android versions 3.0 and above, but works fine on Android 2.x is because Honeycomb and Ice Cream Sandwich are much stricter about abuse against the UI Thread.
引用 Android Developer site 中的以下引用:
A NetworkOnMainThreadException is thrown when an application attempts to perform a networking operation on its main thread. This is only thrown for applications targeting the Honeycomb SDK or higher. Applications targeting earlier SDK versions are allowed to do networking on their main event loop threads, but it's heavily discouraged.
关于java - 关于android中的 "synchronus operations",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25557418/