Kotlin Programming By Example
eBook - ePub

Kotlin Programming By Example

Iyanu Adelekan

Buch teilen
  1. 500 Seiten
  2. English
  3. ePUB (handyfreundlich)
  4. Über iOS und Android verfügbar
eBook - ePub

Kotlin Programming By Example

Iyanu Adelekan

Angaben zum Buch
Buchvorschau
Inhaltsverzeichnis
Quellenangaben

Über dieses Buch

Enhance your Kotlin programming skills by building 3 real-world applicationsAbout This Book• Build three full-fledged, engaging applications from scratch and learn to deploy them• Enhance your app development and programming activities with Kotlin's powerful and intuitive tools and utilities.• Experience the gentle learning curve, expressiveness, and intuitiveness of Kotlin, as you develop your own applicationsWho This Book Is ForThis book is for those who are new to Kotlin or are familiar with the basics, having dabbled with Java until now. Basic programming knowledge is mandatory.What You Will Learn• Learn the building blocks of the Kotlin programming language• Develop powerful RESTful microservices for Android applications• Create reactive Android applications efficiently• Implement an MVC architecture pattern and dependency management using Kotlin• Centralize, transform, and stash data with Logstash• Secure applications using Spring Security• Deploy Kotlin microservices to AWS and Android applications to the Play StoreIn DetailKotlin greatly reduces the verbosity of source code. With Google having announced their support for Kotlin as a first-class language for writing Android apps, now's the time learn how to create apps from scratch with KotlinKotlin Programming By Example takes you through the building blocks of Kotlin, such as functions and classes. You'll explore various features of Kotlin by building three applications of varying complexity. For a quick start to Android development, we look at building a classic game, Tetris, and elaborate on object-oriented programming in Kotlin. Our next application will be a messenger app, a level up in terms of complexity. Before moving onto the third app, we take a look at data persistent methods, helping us learn about the storage and retrieval of useful applications. Our final app is a place reviewer: a web application that will make use of the Google Maps API and Place Picker.By the end of this book, you will have gained experience of of creating and deploying Android applications using Kotlin.Style and approachHere we will build three exciting projects in Kotlin which will demonstrate how to effectively use Kotlin language constructs

Häufig gestellte Fragen

Wie kann ich mein Abo kündigen?
Gehe einfach zum Kontobereich in den Einstellungen und klicke auf „Abo kündigen“ – ganz einfach. Nachdem du gekündigt hast, bleibt deine Mitgliedschaft für den verbleibenden Abozeitraum, den du bereits bezahlt hast, aktiv. Mehr Informationen hier.
(Wie) Kann ich Bücher herunterladen?
Derzeit stehen all unsere auf Mobilgeräte reagierenden ePub-Bücher zum Download über die App zur Verfügung. Die meisten unserer PDFs stehen ebenfalls zum Download bereit; wir arbeiten daran, auch die übrigen PDFs zum Download anzubieten, bei denen dies aktuell noch nicht möglich ist. Weitere Informationen hier.
Welcher Unterschied besteht bei den Preisen zwischen den Aboplänen?
Mit beiden Aboplänen erhältst du vollen Zugang zur Bibliothek und allen Funktionen von Perlego. Die einzigen Unterschiede bestehen im Preis und dem Abozeitraum: Mit dem Jahresabo sparst du auf 12 Monate gerechnet im Vergleich zum Monatsabo rund 30 %.
Was ist Perlego?
Wir sind ein Online-Abodienst für Lehrbücher, bei dem du für weniger als den Preis eines einzelnen Buches pro Monat Zugang zu einer ganzen Online-Bibliothek erhältst. Mit über 1 Million Büchern zu über 1.000 verschiedenen Themen haben wir bestimmt alles, was du brauchst! Weitere Informationen hier.
Unterstützt Perlego Text-zu-Sprache?
Achte auf das Symbol zum Vorlesen in deinem nächsten Buch, um zu sehen, ob du es dir auch anhören kannst. Bei diesem Tool wird dir Text laut vorgelesen, wobei der Text beim Vorlesen auch grafisch hervorgehoben wird. Du kannst das Vorlesen jederzeit anhalten, beschleunigen und verlangsamen. Weitere Informationen hier.
Ist Kotlin Programming By Example als Online-PDF/ePub verfügbar?
Ja, du hast Zugang zu Kotlin Programming By Example von Iyanu Adelekan im PDF- und/oder ePub-Format sowie zu anderen beliebten Büchern aus Informatique & Programmation en Java. Aus unserem Katalog stehen dir über 1 Million Bücher zur Verfügung.

Information

Jahr
2018
ISBN
9781788479783

Building the Messenger Android App – Part I

In the previous chapter, we began building the messenger application by designing and implementing a REST application programming interface that the client messenger application will communicate with. Over the course of implementing the backend API, we covered many things, such as working with Spring Boot, RESTful application programming interfaces and how they work, creating databases with PostgreSQL, and deploying Spring Boot web applications to AWS, to name a few.
In this chapter, we will go one step further in our application development journey by implementing the Android Messenger application and integrating it with the RESTful API we created in Chapter 4, Designing and Implementing the Messenger Backend with Spring Boot 2.0. In the process of developing the Messenger Android app, we will learn a vast array of new topics, such as:
  • Building MVP Android applications
  • Server communication via HTTP
  • Working with Retrofit
  • Reactive programming
  • Using token-based authentication in an Android app
Over the course of this chapter, you will learn firsthand how powerful Kotlin is in the Android application development domain. Let's dive into the development of the Messenger app.

Developing the Messenger app

First, we need to create a new Android Studio project for the application. Create a new Android Studio project with the name Messenger and the package name com.example.messenger. Feel free to take a look at Chapter 1, The Fundamentals, to refresh your memory on Android project creation. In the process of project setup, when asked to create a new launcher activity, name the activity LoginActivity and make it an empty activity.

Including project dependencies

Over the course of this chapter, we will make use of a number of external application dependencies. As such, it is important we include them in the project now. Open your module-level build.gradle file and add the following dependencies to it:
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7
:
$kotlin_version"
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.android.support:recyclerview-v7:26.1.0'
implementation 'com.android.support:design:26.1.0'

implementation "android.arch.persistence.room:runtime:1.0.0-alpha9-1"
implementation "android.arch.persistence.room:rxjava2:1.0.0-alpha9-1"
implementation 'com.android.support:support-v4:26.1.0'
implementation 'com.android.support:support-vector-drawable:26.1.0'
annotationProcessor "android.arch.persistence.room:compiler
:1.0.0-alpha9-1"

implementation "com.squareup.retrofit2:retrofit:2.3.0"
implementation "com.squareup.retrofit2:adapter-rxjava2:2.3.0"
implementation "com.squareup.retrofit2:converter-gson:2.3.0"
implementation "io.reactivex.rxjava2:rxandroid:2.0.1"

implementation 'com.github.stfalcon:chatkit:0.2.2'

testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso
:espresso-core:3.0.1'
}
Ensure that no conflicting Android support library versions exist in the build.gradle file. Now modify the build.gradle project file to include the jcenter and Google repositories as well as the Android build tools dependency:
Top-level build file where you can add configuration options common to all sub-projects/modules:
buildscript {
ext.kotlin_version = '1.1.4-3'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0-alpha9'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}

allprojects {
repositories {
google()
jcenter()
}
}

task clean(type: Delete) {
delete rootProject.buildDir
}
Don't worry, about what the dependencies added for now, all will be revealed over the course of this chapter.

Developing the Login UI

Once the project is created, create a new package named ui in the com.example.messenger application source package. This package will hold all the user-interface-related classes and logic of the Android application. Create a login package within ui. As you may have guessed, this package will hold classes and logic pertaining to the user-login process. Go ahead and move LoginActivity to the login package. Having moved LoginActivity, our first order of business is to create a suitable layout for the login activity.
Locate the activity_login.xml layout resource file and change the following content:
<?xml ver...

Inhaltsverzeichnis