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

Condividi libro
  1. 794 pagine
  2. English
  3. ePUB (disponibile sull'app)
  4. Disponibile su iOS e 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

Dettagli del libro
Anteprima del libro
Indice dei contenuti
Citazioni

Informazioni sul libro

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.

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.
How to Build Android Apps with Kotlin è disponibile online in formato PDF/ePub?
Sì, puoi accedere a How to Build Android Apps with Kotlin di Alex Forrester, Eran Boudjnah, Alexandru Dumbravan, Jomar Tigcal in formato PDF e/o ePub, così come ad altri libri molto apprezzati nelle sezioni relative a Computer Science e Open Source Programming. Scopri oltre 1 milione di libri disponibili nel nostro catalogo.

Informazioni

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

Indice dei contenuti