java - 关于android中的 "synchronus operations"

标签 java android multithreading

Android 书中的一些文字:

"However, starting with Android 3.0, synchronous operations can no longer be run directly from a UI thread. "

我认为在某个线程中运行的每个代码都是“同步操作” 那么,“同步操作”是什么意思呢?

Android运行时如何检测代码是“同步操作”

最佳答案

Alex Lockwood写道:

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/

相关文章:

java - 使用 if 语句依次执行这两个代码

java - 多个不同父类引用的 JPA 子类

用于多线程的 C 信号(替代?)

java - 在webapp中优雅地关闭ExecutorService?

java - Java 类文件中 main() 方法的首选位置

java - ServletContext接口(interface)的log()的使用

android - 调试原生 Android 时的 SIG33

android - 单击文本框时防止 iPhone 放大?

android - 如何获取在 xml 中实例化的自定义 View 的实例?

c++ - 任何编程语言(C++、C#、Java、C...)中声明的函数的最终内存地址是相对的还是绝对的?