Version Third Edition
Platform Android 10
Language Kotlin 1.3
Editor Android Studio 3.6

For Complete Beginners to Android!

If you’re completely new to Android or developing in Kotlin, this is the book for you.

Android Apprentice takes you all the way from building your first app, to submitting your app for sale. By the end of this book, you’ll be experienced enough to turn your vague ideas into real apps that you can release on the Google Play Store.

You’ll build 4 complete apps from scratch — each app is a little more complicated than the previous one. Together, these apps will teach you how to work with the most common controls and APIs used by Android developers around the world.

And these aren’t simple apps, either; you’ll build everything from a simple game, to a checklist app, a map-based app, and a podcast manager and player!

We’ve also included some bonus sections on handling the Android fragmentation problem, how to keep your app up-to-date, preparing your app for release, testing your app, and publishing it for the world to enjoy!

If you’re new to Android programming, you need a guide that:

  • Shows you how to write an app step-by-step
  • With tons of illustrations and screenshots to make everything clear
  • In a fun and easygoing manner!

We’ve written this book in Kotlin: the new, modern, first-class language for Android developers. You’ll be at the leading edge of Android developers everywhere as you learn how to develop in the fluid and expressive Kotlin language.

The Android Apprentice is your best companion for learning Android development. With all project source code included with the book, and support forums right on our site, it’s simply the best way to start your Android development career.

Before You Begin

This section tells you a few things you need to know before you get started, such as what you’ll need for hardware and software, where to find the project files for this book, and more.

i

iii

iv

Section I: Your First Android App

This is your introduction to creating apps in Android. This section will take you step-by-step through installing Android Studio and working inside the IDE and visual designer while you build Timefighter, a simple game that uses many common Android components.

To begin creating that killer Android App, you’ll need some guidance on how to install the tools you’ll need as a young apprentice. Android development takes place inside Android Studio, a customized IDE based on IntelliJ that gives you a powerful set of tools to work with.

1

Layouts

Free

If bricks and mortar are the foundation of a sturdy building, then Layouts are the Android equivalent of a sturdy app. Layouts are incredibly flexible and let you define how your user interface is presented on the device to the user.

2

Activities

Free

Android apps are built around a set of screens that have a specific purpose. Each screen you see in an app is known as an Activity. An Activity is built around a single task that you want your user to perform.

3

Debugging

Free

In the previous two chapters, you focused on developing TimeFighter into a fully-fledged app. In this chapter, you’ll focus on how to debug your app when it begins to exhibit bugs.

4

In this final chapter, you’ll learn how to adjust your app to adhere to the Material Design Guidelines, how to add some small touches to give your app that "polished" feeling, and how to add a simple animation to your app to give it some life.

5

Section II: Building a List App

Welcome to Section II of the book! You’re going to leave behind the last app you made and create a completely new app. This new app is called Listmaker, and will allow you and your users to create handy lists that you can look at later.

In the previous section, you had a starter project to begin building your app. But in this section, you’re going to create your own project from scratch! You’ll go through the steps and choices given to you to ensure your project is set up right from the very start.

You’ll also learn how to persist data to your app using SharedPreferences and create different screens dedicated to different tasks. Towards the end of the section, you’ll learn how to change your App to adapt to different screen sizes using Fragments. Finally, you’ll give Listmaker a design overhaul by enhancing it to follow Material Design. The recommended design language for Android apps.

In the previous section, you had a starter project to begin building your app. But in this section, you’re going to create your own project from scratch! You’ll go through the steps and choices given to you to ensure your project is set up right from the very start.

6

In Android development, the simplest way to implement lists in your app is to use a class named RecyclerView. You’ll how to get started with RecyclerView, how to set up a RecyclerView Adapter to populate your list with data, and how to set up a ViewHolder to handle the layout of each item in your list.

7

In this chapter, you’ll add functionality to ListMaker to create, save, and delete lists. You’ll learn what SharedPreferences are and how you can use them to save and retrieve user data.

8

As your app gets more complex, trying to cram more visual elements into a single screen becomes difficult, and can make your app confusing for users. In this chapter, you’ll learn how to create separate Activites, how to communicate between Activities using an Intent, and how to pass data between Activities.

9

In this chapter, you’re going to build up the Activity you created in the previous chapter with familiar components such as a RecyclerView to display the list, and add a FloatingActionButton to add tasks to the list. You’ll also learn how to communicate back to the previous Activity using an Intent.

10

When it comes to coding an appealing user interface that adapts across all Android devices with varying screen sizes, things can get tricky! Although you won’t be building an app for a fridge just yet (give it time), in this chapter you’ll learn what Fragments are and how they work with Activities and how to split up Activities into Fragments.

11

Material Design is a design language that aims to standardize how a user interacts with an app. This ranges from everything to button clicks, to widget presentation and positioning, even to animation within the app. In this chapter, you’ll update ListMaker so it adopts some Material Design principles.

12

Section III: Creating Map-Based Apps

In this section, you’ll build PlaceBook, a location based app that lets you bookmark your favorite places and save some notes about each place. This section introduces several new concepts including Google Maps, Room database, drawer navigation, and camera control.

Have you ever been on a road trip and wanted to makes notes about places you’ve visited? Or needed to warn your future self about some heartburn-inducing greasy food from a roadside diner? If so, then you’re in luck! You’re about to build PlaceBook, an app that meets all of those needs by letting you bookmark and make notes using a map-based interface.

13

In this chapter, you’ll tighten up the map experience by automatically centering the map on the user’s location at startup, and allowing the user to recenter the map to their current location at any time.

14

Before you can achieve your ultimate goal of allowing users to bookmark places, you need to let them identify existing places on the map. In this chapter, you'll learn how to identify when a user taps on a place and use the Google Places API to retrieve detailed information about the place.

15

Now that the user can tap on places to get an info window pop-up, it’s time to give them a way to bookmark and edit a place. You’ll learn about the Room Persistence Library and how it fits into the overall Android Component Architecture.

16

In this chapter you'll add the ability to edit bookmarks. This will involve creating a new activity to display the bookmark details with editable fields.

17

Currently, the only way to find an existing bookmark is to locate its pin on the map. In this chapter, you’ll add the ability to navigate directly to bookmarks, and you’ll replace the photo for a bookmark.

18

In this chapter you’ll add some finishing touches that improve both the look and usability of the PlaceBook app. Even though PlaceBook is perfectly functional as-is, it’s often the little touches that make an app go from good to great.

19

Section IV: Building a Podcast Manager & Player

This section gets a bit more advanced. You’re going to build a podcast manager and player app named PodPlay. You’ll cover networking, notifications, working with REST and XML, and the Android media libraries.

In this section, you’re going to use many of the skills you’ve already learned and dive into some more advanced areas of Android development. You’ll build a full-featured Podcast manager and player app named PodPlay. This app will allow searching and subscribing to podcasts from iTunes and provide a playback interface with speed controls.

20

Creating a search interface can be as simple as adding a text view, responding to the user entering text, and populating a RecyclerView with the results. While this method works fine, the Android SDK provides a built-in search feature that helps future-proof your apps.

21

Now that the user can find their favorite podcasts, you’re ready to add a podcast detail screen. In this chapter, you’ll design and build the podcast detail fragment, expand on the app architecture, and add a podcast detail fragment.

22

Until this point, you’ve only dealt with the top-level podcast details. Now it’s time to dive deeper into the podcast episode details, and that involves loading and parsing the RSS feeds.

23

By giving users the ability to search for podcasts and displaying the podcast episodes, you made great progress in the development of the podcast app. In this section, you’ll add the ability to subscribe to favorite podcasts.

24

Now that the user can subscribe to podcasts, it’s helpful to notify them when new episodes are available. In this chapter, you’ll update the app to periodically check for new episodes in the background and post a notification if any are found.

25

So far, you’ve built a decent podcast management app — too bad there’s no way to listen to content. In this chapter, you’ll learn how to build a media player that plays audio and video podcasts, and integrates into the Android ecosystem.

26

In the last chapter, you succeeded in adding audio playback to the app, but you stopped short of adding any built-in playback features. In this final chapter of this section, you’ll finish up the PodPlay app by adding a full playback interface and support for videos.

27

Section V: Android Compatibility

This section covers two Android topics that are almost as important as your Android app itself: how to handle the collection of Android versions out there, known as the fragmentation problem, and how to best keep your app up to date in the face of constant updates to Android.

In a perfect world, every Android device would run a single version of Android and app development would be easy. Sadly, the world isn’t perfect. As of May 2017, there were two billion active Android devices around the world, all running various versions and flavors of Android. This chapter explores the history of Android versions, and how developers can target as many versions of Android as possible.

28

The more you commit to your app, the more value your users will see in the product. Keeping your app up-to-date is an incentive to growing that important group of users. Publishing an app is an achievement, but supporting an app over the years to come is an even greater achievement.

29

Section VI: Publishing Your App

Now that you’ve created your app, you need to get it out to the world! This section has two chapters that teach you how to prepare your app for release, how to test your app, and how to publish your app to your waiting fans!

So you finally built that app you’ve been dreaming about. Now it’s time to share it with the world! But where do you start? Although this chapter will focus primarily on preparing the app for the Google Play store, most of the steps will apply regardless of the publishing platform.

30

In this chapter, you’ll complete the app publishing process and discover additional ways to distribute your app. You’ll also go through the Alpha and Beta testing process to make sure your app is ready to share with the world.

31

Meet the team

Contributors

Who is this book for

If you’re completely new to Android or developing in Kotlin, this is the book for you.

Concepts covered in this book

  • Layouts
  • Debugging
  • Communication
  • Scrolling Layouts
  • Google Places
  • Networking
  • Material Design

Version history

Third Edition · Android 10, Kotlin 1.3, Android Studio 3.6

v3.0 · May 19 2020 · Fuad Kamal, Darryl Bayliss, Namrata Bandekar & Tom Blankenship

Android Apprentice

By Fuad Kamal, Darryl Bayliss, Namrata Bandekar and Tom Blankenship

Build four complete Android apps from scratch using Kotlin! Android Apprentice is our book for complete beginners to Android development.

Read for Free with an Ultimate Beginner Subscription* * Includes this and all other Beginner books in our online library See all benefits
Buy Individually $59.99* *Includes access to all of our online reading features.
See buying options
Hide buying options

All videos. All books.
One low price.

A raywenderlich.com subscription is the best way to learn and master mobile development — plans start at just $19.99/month!

Learn iOS, Swift, Android, Kotlin, Flutter and Dart development and unlock our massive catalog of 50+ books and 4,000+ videos.