11/1/2023 0 Comments Kotlin range toWithout using the help of multi-threading APIs (Such as Runnable, Coroutines, RxJava), you will automatically be invoking Thread.sleep(1000) on the UI Thread that is why you are experiencing such "UI Freezing" experience because, other UI Operations are blocked from accessing the thread since you have invoke a suspension on it. Ranges are defined for comparable types: having an order, you can define whether an arbitrary instance is in the range between two given instances. It is often called that because this single thread displays the user interface and listens for events that occur when the user interacts with the app. A range defines a closed interval in the mathematical sense: it is defined by its two endpoint values, which are both included in the range. On the Android platform, applications operate, by default, on one thread. Main Thread or if you are doing your stuff in Android, it is often called the UI Thread: It freezes the UI, does somebody know why this is happening?Īs mentioned above from the official documentation of Java, you are experiencing a some sort of freezing in the UI because you have called it in the Main Thread. This is an efficient means of making processor time available to the other threads of an application or other applications that might be running on a computer system.įor the OP (Original Poster / Asker)'s clarification: Thread.sleep causes the current thread to suspend execution for a specified period.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |