Pro Android with Kotlin
Download 5.42 Mb. Pdf ko'rish
|
@de android telegram Pro Android with Kotlin Developing Modern Mobile
140
CHAPTER 8: APIs Table 8-5. Auxiliary AlarmManager Methods Method Description cancel(operation: PendingIntent) : Unit This removes any alarms with a matching intent. cancel(listener: AlarmManager. OnAlarmListener): Unit This removes any alarm scheduled to be delivered to the given AlarmManager.OnAlarmListener. getNextAlarmClock() : AlarmManager. AlarmClockInfo This gets information about the next alarm clock currently scheduled. setTime(long millis): Unit This sets the system wall clock time, UTC (milliseconds since January 1, 1970, 00:00:00). setTimeZone(String timeZone): Unit This sets the system’s persistent default time zone. Loaders Loaders are for loading data in the background. The main usage pattern is as follows: 1. The need to load data in a presumably time-consuming process arises, either in the UI thread after, for example, clicking a button or from any other place inside the code. Because the loading is expected to take some time, you want to have the loading happen in the background, not disturbing the UI, for example. 2. You get the LoaderManager from the context. From within activities, in Kotlin you just use the pseudo-getter loaderManager. 3. You implement and provide a subclass of LoaderManager. LoaderCallbacks. The main responsibility of this class consists of constructing an android.content.Loader and providing loading state callback functions. 4. You call init(...) on the LoaderManager and pass the callback’s implementation. 5. You react on callback events. Looking at the online API documentation for the Loader framework, two points are worth mentioning. Almost all over the description and for all examples (and also for almost all examples you can find on the Web), using the compatibility libraries for the Loader framework classes is suggested. This is for backward compatibility. The truth is, you don’t have to do that. The Loader framework has been around for quite a while, since API level 11 to be precise, and since you might not care about the less than 1 percent in- use versions below API 11, the need to use the compatibility libraries for Loader framework classes might not be too high. |
Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling
ma'muriyatiga murojaat qiling