Kotlin Programming By Example
eBook - ePub

Kotlin Programming By Example

Iyanu Adelekan

Partager le livre
  1. 500 pages
  2. English
  3. ePUB (adapté aux mobiles)
  4. Disponible sur iOS et Android
eBook - ePub

Kotlin Programming By Example

Iyanu Adelekan

DĂ©tails du livre
Aperçu du livre
Table des matiĂšres
Citations

À propos de ce livre

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

Foire aux questions

Comment puis-je résilier mon abonnement ?
Il vous suffit de vous rendre dans la section compte dans paramĂštres et de cliquer sur « RĂ©silier l’abonnement ». C’est aussi simple que cela ! Une fois que vous aurez rĂ©siliĂ© votre abonnement, il restera actif pour le reste de la pĂ©riode pour laquelle vous avez payĂ©. DĂ©couvrez-en plus ici.
Puis-je / comment puis-je télécharger des livres ?
Pour le moment, tous nos livres en format ePub adaptĂ©s aux mobiles peuvent ĂȘtre tĂ©lĂ©chargĂ©s via l’application. La plupart de nos PDF sont Ă©galement disponibles en tĂ©lĂ©chargement et les autres seront tĂ©lĂ©chargeables trĂšs prochainement. DĂ©couvrez-en plus ici.
Quelle est la différence entre les formules tarifaires ?
Les deux abonnements vous donnent un accĂšs complet Ă  la bibliothĂšque et Ă  toutes les fonctionnalitĂ©s de Perlego. Les seules diffĂ©rences sont les tarifs ainsi que la pĂ©riode d’abonnement : avec l’abonnement annuel, vous Ă©conomiserez environ 30 % par rapport Ă  12 mois d’abonnement mensuel.
Qu’est-ce que Perlego ?
Nous sommes un service d’abonnement Ă  des ouvrages universitaires en ligne, oĂč vous pouvez accĂ©der Ă  toute une bibliothĂšque pour un prix infĂ©rieur Ă  celui d’un seul livre par mois. Avec plus d’un million de livres sur plus de 1 000 sujets, nous avons ce qu’il vous faut ! DĂ©couvrez-en plus ici.
Prenez-vous en charge la synthÚse vocale ?
Recherchez le symbole Écouter sur votre prochain livre pour voir si vous pouvez l’écouter. L’outil Écouter lit le texte Ă  haute voix pour vous, en surlignant le passage qui est en cours de lecture. Vous pouvez le mettre sur pause, l’accĂ©lĂ©rer ou le ralentir. DĂ©couvrez-en plus ici.
Est-ce que Kotlin Programming By Example est un PDF/ePUB en ligne ?
Oui, vous pouvez accĂ©der Ă  Kotlin Programming By Example par Iyanu Adelekan en format PDF et/ou ePUB ainsi qu’à d’autres livres populaires dans Computer Science et Programming in Java. Nous disposons de plus d’un million d’ouvrages Ă  dĂ©couvrir dans notre catalogue.

Informations

Année
2018
ISBN
9781788479783
Édition
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...

Table des matiĂšres