Tìm hiểu về Kotlin Coroutine
1. Coroutine là gì ?
Về cơ bản thì coroutines là 1 thuật toán có khả năng dừng (suspend) và tiếp tục (resume) việc thực thi code nằm trong nó mà không làm cho thread bị block. Trong Android, nếu bạn chạy 1 hàm phức tạp nào đó trên main thread thì nó sẽ block UI cho đến khi hàm chạy xong.
Block UI sẽ làm cho app rơi vào trạng thái ANR và khả năng lớn là user sẽ uninstall app của bạn. Ngược lại, suspend tỏ ra...
Kotlin
Android
May Fest
Coroutine
1491