December 2017
Intermediate to advanced
260 pages
7h 34m
English
Interfaces are very popular among developers. They are used to decouple the code. Kotlin interfaces are very much like Java 8 interfaces. That means they can have both abstract methods as well as method implementation.
You can declare properties in interfaces. A property declared in an interface can either be abstract, or it can provide implementations for accessors. Properties declared in interfaces can't have backing fields and therefore accessors declared in interfaces can't reference them.
Take a look at our interface AppToolbar.kt, which deals with the Toolbar. It has got a property that provides a title to the Toolbar and it has a function that initiates it with required data:
interface AppToolbar { val toolbar: Toolbar ...
Read now
Unlock full access