October 2019
Intermediate to advanced
434 pages
11h 54m
English
Core KTX includes packages built around a variety of core Android framework libraries and APIs, including the following:
One of the best examples of using Android KTX to simplify platform APIs is in the use of SharedPreferences. With the functionality of Kotlin available to us, we can use a very fluent syntax for editing SharedPreferences that removes the need to explicitly call commit() or apply():
val preferences = getPreferences(Context.MODE_PRIVATE)preferences.edit { putBoolean("key", false) putString("key2", "value")}
Another example of useful functionality provided by Android KTX is the View.onPreDraw() extension function: ...
Read now
Unlock full access