Kotlin Programming By Example
eBook - ePub

Kotlin Programming By Example

Iyanu Adelekan

Condividi libro
  1. 500 pagine
  2. English
  3. ePUB (disponibile sull'app)
  4. Disponibile su iOS e Android
eBook - ePub

Kotlin Programming By Example

Iyanu Adelekan

Dettagli del libro
Anteprima del libro
Indice dei contenuti
Citazioni

Informazioni sul libro

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

Domande frequenti

Come faccio ad annullare l'abbonamento?
È semplicissimo: basta accedere alla sezione Account nelle Impostazioni e cliccare su "Annulla abbonamento". Dopo la cancellazione, l'abbonamento rimarrà attivo per il periodo rimanente già pagato. Per maggiori informazioni, clicca qui
È possibile scaricare libri? Se sì, come?
Al momento è possibile scaricare tramite l'app tutti i nostri libri ePub mobile-friendly. Anche la maggior parte dei nostri PDF è scaricabile e stiamo lavorando per rendere disponibile quanto prima il download di tutti gli altri file. Per maggiori informazioni, clicca qui
Che differenza c'è tra i piani?
Entrambi i piani ti danno accesso illimitato alla libreria e a tutte le funzionalità di Perlego. Le uniche differenze sono il prezzo e il periodo di abbonamento: con il piano annuale risparmierai circa il 30% rispetto a 12 rate con quello mensile.
Cos'è Perlego?
Perlego è un servizio di abbonamento a testi accademici, che ti permette di accedere a un'intera libreria online a un prezzo inferiore rispetto a quello che pagheresti per acquistare un singolo libro al mese. Con oltre 1 milione di testi suddivisi in più di 1.000 categorie, troverai sicuramente ciò che fa per te! Per maggiori informazioni, clicca qui.
Perlego supporta la sintesi vocale?
Cerca l'icona Sintesi vocale nel prossimo libro che leggerai per verificare se è possibile riprodurre l'audio. Questo strumento permette di leggere il testo a voce alta, evidenziandolo man mano che la lettura procede. Puoi aumentare o diminuire la velocità della sintesi vocale, oppure sospendere la riproduzione. Per maggiori informazioni, clicca qui.
Kotlin Programming By Example è disponibile online in formato PDF/ePub?
Sì, puoi accedere a Kotlin Programming By Example di Iyanu Adelekan in formato PDF e/o ePub, così come ad altri libri molto apprezzati nelle sezioni relative a Computer Science e Programming in Java. Scopri oltre 1 milione di libri disponibili nel nostro catalogo.

Informazioni

Anno
2018
ISBN
9781788479783
Edizione
1

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...

Indice dei contenuti