Build four complete Android apps from scratch using Kotlin!
Android Apprentice is our book for complete beginners to Android development.
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:
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.
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 component
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
In this section, you’ll build PlaceBook, an app that lets you bookmark your favorite places and save some notes about each place.
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.
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.
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.
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.
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.
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.
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.
This section gets a bit more advanced. You’re going to build a podcast manager and player app named PodPlay. You’ll cover networking, 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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.