How to Build Android Apps with Kotlin
eBook - ePub

How to Build Android Apps with Kotlin

A hands-on guide to developing, testing, and publishing your first apps with Android

Alex Forrester, Eran Boudjnah, Alexandru Dumbravan, Jomar Tigcal

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

How to Build Android Apps with Kotlin

A hands-on guide to developing, testing, and publishing your first apps with Android

Alex Forrester, Eran Boudjnah, Alexandru Dumbravan, Jomar Tigcal

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

À propos de ce livre

Master the fundamentals of Android programming and apply your skills to create scalable and reliable apps using industry best practices

Key Features

  • Build apps with Kotlin, Google's preferred programming language for Android development
  • Unlock solutions to development challenges with guidance from experienced Android professionals
  • Improve your apps by adding valuable features that make use of advanced functionality

Book Description

Are you keen to get started building Android 11 apps, but don't know where to start? How to Build Android Apps with Kotlin is a comprehensive guide that will help kick-start your Android development practice.

This book starts with the fundamentals of app development, enabling you to utilize Android Studio and Kotlin to get started building Android projects. You'll learn how to create apps and run them on virtual devices through guided exercises. Progressing through the chapters, you'll delve into Android's RecyclerView to make the most of lists, images, and maps, and see how to fetch data from a web service.

Moving ahead, you'll get to grips with testing, learn how to keep your architecture clean, understand how to persist data, and gain basic knowledge of the dependency injection pattern. Finally, you'll see how to publish your apps on the Google Play store.

You'll work on realistic projects that are split up into bitesize exercises and activities, allowing you to challenge yourself in an enjoyable and attainable way. You'll build apps to create quizzes, read news articles, check weather reports, store recipes, retrieve movie information, and remind you where you parked your car.

By the end of this book, you'll have the skills and confidence to build your own creative Android applications using Kotlin.

What you will learn

  • Create maintainable and scalable apps using Kotlin
  • Understand the Android development lifecycle
  • Simplify app development with Google architecture components
  • Use standard libraries for dependency injection and data parsing
  • Apply the repository pattern to retrieve data from outside sources
  • Publish your app on the Google Play store

Who this book is for

If you want to build your own Android applications using Kotlin but are unsure of how to begin, then this book is for you. To easily grasp the concepts in this book, it is recommended that you already have a basic understanding of Kotlin, or experience in a similar programming language and a willingness to brush up on Kotlin before you start.

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 How to Build Android Apps with Kotlin est un PDF/ePUB en ligne ?
Oui, vous pouvez accĂ©der Ă  How to Build Android Apps with Kotlin par Alex Forrester, Eran Boudjnah, Alexandru Dumbravan, Jomar Tigcal en format PDF et/ou ePUB ainsi qu’à d’autres livres populaires dans Computer Science et Open Source Programming. Nous disposons de plus d’un million d’ouvrages Ă  dĂ©couvrir dans notre catalogue.

Informations

Année
2021
ISBN
9781838988296

1. Creating Your First App

Overview
This chapter is an introduction to Android, where you will set up your environment and focus on the fundamentals of Android development. By the end of this chapter, you will have gained the knowledge required to create an Android app from scratch and install it on a virtual or physical Android device. You will be able to analyze and understand the importance of the AndroidManifest.xml file, and use the Gradle build tool to configure your app and implement UI elements from Material Design.

Introduction

Android is the most widely used mobile phone operating system in the world, with over 70% of the global market share (see https://gs.statcounter.com/os-market-share/mobile/worldwide). This presents great opportunities to contribute and make an impact by learning Android and building apps that have a global reach. For a developer who is new to Android, there are many issues you must contend with in order to get started learning and becoming productive. This book will address these issues. After learning the tooling and development environment, you will explore fundamental practices to build Android apps. We will cover a wide range of real-world development challenges faced by developers and explore various techniques to overcome them.
In this chapter, you will learn how to create a basic Android project and add features to it. You will be introduced to the comprehensive development environment of Android Studio and learn about the core areas of the software to enable you to work productively. Android Studio provides all the tooling for application development, but not the knowledge. This first chapter will guide you through using the software effectively to build an app and configure the most common areas of an Android project.
Let's get started creating an Android project.

Creating an Android Project with Android Studio

In order to be productive in terms of building Android apps, it is essential to become confident with how to use Android Studio. This is the official Integrated Development Environment (IDE) for Android development, built on JetBrains' IntelliJ IDEA IDE and developed by the Android Studio team at Google. You will be using it throughout this course to create apps and progressively add more advanced features.
The development of Android Studio has followed the development of the IntelliJ IDEA IDE. The fundamental features of an IDE are of course present, enabling you to optimize your code with suggestions, shortcuts, and standard refactoring. The programming language you will be using throughout this course to create Android apps is Kotlin. Since Google I/O 2017 (the annual Google developer conference), this has been Google's preferred language for Android app development. What really sets Android Studio apart from other Android development environments is that Kotlin was created by JetBrains, the company that created IntelliJ IDEA, the software Android Studio is built on. You can, therefore, benefit from established and evolving first-class support for Kotlin.
Kotlin was created to address some of the shortcomings of Java in terms of verbosity, handling null types, and adding more functional programming techniques, amongst many other issues. As Kotlin has been the preferred language for Android development since 2017, taking over from Java, you will be using it in this book.
Getting to grips and familiarizing yourself with Android Studio will enable you to feel confident working on and building Android apps. So, let's get started creating your first project.
Note
The installation and setup of Android Studio are covered in the Preface. Please ensure you have completed those steps before you continue.

Exercise 1.01: Creating an Android Studio Project for Your App

This is the starting point for creating a project structure your app will be built upon. The template-driven approach will enable you to create a basic project in a short timeframe whilst setting up the building blocks you can use to develop your app. To complete this exercise, perform the following steps:
Note
The version of Android Studio you will be using is v4.1.1 (or above).
  1. Upon opening Android Studio, you will see a window asking whether you want to create a new project or open an existing one. Select Create New Project.
    The start up window will appear as follows:
    Figure 1.1: Android Studio version 4.1.1
    Figure 1.1: Android Studio version 4.1.1
  2. Now, you'll enter a simple wizard-driven flow, which greatly simplifies the creation of your first Android project. The next screen you will see has a large number of options for the initial setup you'd like your app to have:
    Figure 1.2: Starting a project template for your app
    Figure 1.2: Starting a project template for your app
  3. Welcome to your first introduction to the Android development ecosystem. The word displayed in most of the project types is Activity. In Android, an Activity is a page or screen. The options you can choose from on the preceding screen all create this initial screen differently. The descriptions describe how the first screen of the app will look. These are templates to build your app with. Select Empty Activity from the template and click on next.
    The project configuration screen is as follows:
    Figure 1.3: Project configuration
    Figure 1.3: Project configuration
  4. The preceding screen configures your app. Let's go through all the options:
    a. Name: Similar to the name of your Android project, this name will appear as the default name of your app when it's installed on a phone and visible on Google Play. You can replace the Name field with your own or set it now to the app you are going to create.
    b. Package name: This uses the standard reverse domain name pattern for creating a name. It will be used as an address identifier for source code and assets in your app. It is best to make this name as clear and descriptive and as closely aligned with the purpose of your app as possible. Therefore, it's probably best to change this to use one or more sub-domains (such as com.sample.shop.myshop). As shown in Figure 1.3, the Name of the app (in lowercase with spaces removed) is appended to the domain.
    c. Save location: This is the local folder on your machine where the app will be initially stored. This can be changed in the future, so you can probably keep the default or edit it to something different (such as Users/MyUser/android/projects). The default location will vary with the operating system you are using.
    d. Language – Kotlin: This is Google's preferred language for Android app development.
    e. Minimum SDK: Depending on which version of Android Studio you download, the default might be the same as displayed in Figure 1.3 or a...

Table des matiĂšres