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

Buch teilen
  1. 794 Seiten
  2. English
  3. ePUB (handyfreundlich)
  4. Über iOS und Android verfügbar
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

Angaben zum Buch
Buchvorschau
Inhaltsverzeichnis
Quellenangaben

Über dieses Buch

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.

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 How to Build Android Apps with Kotlin als Online-PDF/ePub verfügbar?
Ja, du hast Zugang zu How to Build Android Apps with Kotlin von Alex Forrester, Eran Boudjnah, Alexandru Dumbravan, Jomar Tigcal im PDF- und/oder ePub-Format sowie zu anderen beliebten Büchern aus Computer Science & Open Source Programming. Aus unserem Katalog stehen dir über 1 Million Bücher zur Verfügung.

Information

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

Inhaltsverzeichnis