- Learning Concurrency in Kotlin
- Miguel Angel Castiblanco Torres
- 102字
- 2021-08-05 10:46:47
CalledFromWrongThreadException
Android will throw a CalledFromWrongThreadException whenever a thread that didn't create a view hierarchy tries to update its views. In practical terms, this exception will happen whenever a thread other than the UI thread updates a view. This is because the UI thread is the only one that can create view hierarchies, so it will always be the one that can update them.
It's important to guarantee that code that will update the UI is running in the UI thread. In our example, we will update a label on the UI thread after calling a service on a background thread.
推薦閱讀
- ThinkPHP 5實戰
- Twilio Best Practices
- Clojure for Domain:specific Languages
- Mastering JavaScript Design Patterns(Second Edition)
- 編程菜鳥學Python數據分析
- Java Web開發詳解
- Getting Started with Python and Raspberry Pi
- UI設計全書(全彩)
- WebStorm Essentials
- Go語言入門經典
- Hands-On Dependency Injection in Go
- 交互設計師成長手冊:從零開始學交互
- Mastering PowerCLI
- Python數據預處理技術與實踐
- Clojure Data Structures and Algorithms Cookbook