Learn Kotlin the easy way while developing an Android App.
Kotlin is the new official language to write Android Apps, and thanks to this book, you'll be writing code in no time. Straight to the point, practical and full of examples, it will show you the language while developing an Android App. Learn the Kotlin and start enjoying Android development again with this powerful and modern language.
Author(s): Antonio Leiva
Publisher: Leanpub
Year: 2017
Language: English
Pages: 191
Tags: Kotlin, Android Development, Programming
I. About this book
What is “Kotlin for Android Developers” about
II. Is this book for you?
III. About the author
1 Introduction
1.1 What is Kotlin?
1.2 What do we get with Kotlin?
2 Getting ready
2.1 Android Studio
2.2 Install Kotlin plugin
3 Creating a new project
3.1 Create a new project in Android Studio
3.2 Convert MainActivity to Kotlin code
3.3 Configure Kotlin in project
3.4 Include some other useful configuration
3.5 Test that everything works
4 Classes and functions
4.1 How to declare a class
4.2 Class inheritance
4.3 Functions
4.4 Constructor and functions parameters
5 Writing your first class
5.1 Creating the layout
5.2 The Recycler Adapter
6 Variables and properties
6.1 Basic types
6.2 Variables
6.3 Properties
7 Anko and Extension Functions
7.1 What is Anko?
7.2 Start using Anko
7.3 Extension functions
8 Retrieving data from API
8.1 Performing a request
8.2 Performing the request out of the main thread
9 Data Classes
9.1 Extra functions
9.2 Copying a data class
9.3 Mapping an object into variables
10 Parsing data
10.1 Converting json to data classes
10.2 Shaping the domain layer
10.3 Drawing the data in the UI
11 Operator overloading
11.1 Operators tables
11.2 An example
11.3 Operators in extension functions
12 Making the forecast list clickable
13 Lambdas
13.1 Simplifying setOnClickListener()
13.2 Click listener for ForecastListAdapter
13.3 Extending the language
14 Visibility Modifiers
14.1 Modifiers
14.2 Constructors
14.3 Reviewing our code
15 Kotlin Android Extensions
15.1 How to use Kotlin Android Extensions
15.2 Refactoring our code
16 Application Singleton and Delegated Properties
16.1 Application Singleton
16.2 Delegated Properties
16.3 Standard Delegates
16.4 How to create a custom delegate
16.5 Reimplementing App Singleton
17 Creating an SQLiteOpenHelper
17.1 ManagedSqliteOpenHelper
17.2 Tables definition
17.3 Implementing SqliteOpenHelper
17.4 Dependency injection
18 Collections and functional operations
18.1 Aggregate operations
18.2 Filtering operations
18.3 Mapping operations
18.4 Elements operations
18.5 Generation operations
18.6 Ordering operations
19 Saving and requesting data from database
19.1 Creating database model classes
19.2 Writing and requesting data
20 Null safety in Kotlin
20.1 How Null types work
20.2 Nullity and Java libraries
21 Creating the business logic to data access
22. Flow control and ranges
22.1 If Expression
22.2 When expression
22.3 For loops
22.4 While and do/while loops
22.5 Ranges
23 Creating a Detail Activity
23.1 Preparing the request
23.2 Providing a new activity
23.3 Start an activity: reified functions
24 Interfaces and Delegation
24.1 Interfaces
24.2 Delegation
24.3 Implementing an example in our App
25 Generics
25.1 Basics
25.2 Variance
25.3 Generics examples
26 Settings Screen
26.1 Creating the settings activity
26.2 Accessing Shared Preferences
26.3 Generic preference delegate
27 A first walk into coroutines
27.1 Understanding how coroutines work
27.2 Using Anko for coroutines
27.3 Using coroutines in our example
28 Testing your App
28.1 Unit testing
28.2 Mocking closed classes
28.3 Instrumentation tests
29 Extra concepts
29.1 Nested classes
29.2 Enum classes
29.3 Sealed classes
29.4 Exceptions
30 Conclusion