A common question I get asked all the time is how do you create a mobile app? The Covid pandemic has put a lot of people back into the job market and many are considering a career in programming, specifically mobile app development. To do my part to support people who want to learn Android app development I am beginning a ten articles series where I show you how to create a complete Android app. The skills you learn by creating your first fully functional Android app will help you get started on a career path with lots of upsides because the demand for Android development skills has never been higher.
An expanded version of this series with the completed source code is available in book format for a modest cost. In this series, you will learn Android development through the process of creating a fully-featured reminder Android app called Pronto Task. Based on my experience, it is more effective to create a complete usable project when learning new programming concepts. Pronto Task is an Android App that allows users to manage their daily tasks. Users can create Tasks (Todo List). Each Task can have zero to many SubTasks (Todo Items). Each task can have a Reminders, and the Reminder could be a Time Reminder or a Repeating Reminder. Each Sub Task should have a checkbox to mark it complete.
Figure 1 shows a screenshot of the app that we will be creating in this book.
Here are the topics we will cover in this series
- Day 1 – Introduction to Android Development
- Day 2 – Just Enough Kotlin
- Day 3 – Core Android Development Concepts
- Day 4 – Composable User Interface
- Day 5 – Android App Architecture
- Day 6 – Create Pronto Task UI – Part 1
- Day 7 – Create Pronto Task UI – Part 2
- Day 8 – Working with Room Database and Respository
- Day 9 – Implement Reminder & Notification
- Day 10 – Android App Publishing Basics
Key Android Development Terminologies and Keywords
The field of programming and Android development, in particular, is littered with an endless stream of terminologies, keywords, and acronyms. Over time, these terminologies will become part of your vocabulary. Below is a list of Android development terminologies that I believe will help you grasp the fundamentals of Android development. If you are an experienced Android developer you can skip this section.
Android is an Operating System (OS). Computer Operating System is a term used to reference the group of computer programs that work together to help a user interact with a computer. Without an Operating System, your Android phone or any other Android device is just a collection of hardware with an integrated circuit board. Figure 1.2 is a pictorial representation of the design of Android Architecture. The term architecture in the context of software means, the description of the major components of the system and how they interact with each other.
While learning about the other layers: Linux Kernel, Libraries, Android Runtime, and the Application Framework is not a prerequisite to learning Android, understanding how they work especially the Android Runtime is highly beneficial.
Integrated Development Environment (IDE)
Painters use paintbrushes to create their work, potters use their hands to create pottery and programmers use the keyboard to type their code. This code can be typed into any editor such as notepad. However, there are special-purpose editors that are specifically made for writing code the same way special editors such as Microsoft Word are made for creating rich content. These special-purpose editors are called Integrated Development Environment because a lot of tools, resources, and helpers are packed on top of the editor to make the work of the programmer easier. What’s more, there are specialized IDEs suited for different types of software development such as web development, and the one that is purpose-built for Android development is called Android Studio.
Android Studio is the official IDE for developing Android apps. Like every profession, Android development requires some tools to develop Android applications, and you will be an efficient developer to the extent that you master the tools of the trade. Chief amongst these tools is Android Studio and what makes Android Studio special is that it is a toolbox that contains other tools. For the most part, all you need to start developing Android apps are an Android device, your personal computer with Android Studio installed. We will learn more about Android Studio later in this Chapter.
Software Development Kit
A software development kit is a set of programming tools that allow third-party developers access to enhance or modify the behavior of an application or library. When you develop Software that is backed by a major Software corporation they will normally provide you with a set of guidelines, tools, support materials, software packages, etc that will aid you in creating software that is consistent with that platform. That package is called Software Development Kit or SDK, so for Android, there is an Android SDK provided and supported by Google, if you develop for the iOS platform there is an SDK provided and supported by Apple, if you develop for the Windows platform there is an SDK provided and supported by Microsoft and so on. Android SDK is mostly bundled with Android Studio.
API & API Level
In the context of Android development, API Level is a number that is used to reference the set of capabilities that is available and thereby exposed by a particular version of the Android Framework. To understand this term, let’s agree that any Android app you want to develop will be a combination of the custom code that you will write and the existing Android framework, libraries, and programs. Now, let’s assume that the ratio of this composition is 50/50, which means 50% is your code and 50% is Android framework code. The question then is how do you which capabilities or features are available in that 50% of your project?. That’s where the API level comes in.
For example, Android 5.0 codenamed Lolipop supports something called Material Design. So as a developer, if you want to leverage Material Design in your app, then you have to leverage or target an API level that supports Android 5.0 in this case that would be API Level 21. If you target API Level 19 for example, then it will not include the support for Material Design.
Kotlin is the official programming language for developing Android apps. Kotlin is used to develop other types of applications including but not limited to Web, Desktop, and backend applications. Kotlin is developed and supported by a company called Jet Brains. Kotlin is an object-oriented programming (OOP) language so as part of our intro to Kotlin, you will get a primer on OOP. This book is entirely based on Kotlin and there is zero doubt that Kotlin is the feature of Android development.
Jetpack Compose is a new toolkit from Google for creating an Android app user interface. Traditionally, XML layouts are used to create Android app user interface layouts. These XML files are then inflated into Views that are displayed on the screen. Jetpack Compose does away with XML and allows us, developers, to describe our screen using Kotlin code. This presents a lot of advantages, but also comes with a steep learning curve and a paradigm shift for us developers who are schooled in the traditional XML-based approach. But lucky you, this book will not place the burden of learning legacy layout on you, instead, this book is based on Jetpack Compose.
Each time you are using an Android app, the elements on each screen are organized to accomplish a task, to perform an activity. This Activity could be browsing the Internet, scrolling through a social media feed, viewing/editing content, or playing a game. Whatever each screen of the app is doing, Android regards each screen as an Activity and the name of the Android component that is responsible for presenting and managing the elements in each Android app screen is called – wait for it, an Activity! This is a core component of Android development that you will master in this book and use extensively in your Android development career. We will learn more about Activity on Day 3, however here is an official definition of an Activity from the Android Developer Guide.
An activity provides the window in which the app draws its UI. This window typically fills the screen but may be smaller than the screen and float on top of other windows. Generally, one activity implements one screen in an app. For instance, one of an app’s activities may implement a Preferences screen, while another activity implements a Select Photo screen.
The fragment was an important Android component, literally, no article or tutorial about Android development is complete without the mention of Activity or Fragment. However, Fragment became one of the components that Jetpack Compose has made optional at best but legacy in reality. So what is a Fragment? Well, let’s lean on the official documentation to explain what a Fragment is, and here is how it explains it.
A Fragment represents a behavior or a portion of a user interface in a FragmentActivity. You can combine multiple fragments in a single activity to build a multi-pane UI and reuse a fragment in multiple activities.
Think of Fragments as resizable partitions of an Activity’s screen real estate. Activity owns the screen and it’s not resizable or collapsable during runtime without destroying it and recreating it. However, Fragments are dynamically resizable and collapsable. We will not learn or use Fragment in this book because as mentioned Jetpack Compose has made them not required.
In the context of software development, the terms build and compile are often used interchangeably to refer to the process of converting code into a program. However, they have a nuanced difference that can be summarized as follows:
- Compile – translates Kotlin/Java code (human-readable) into bytecode, so the Virtual machine understands it.
- Build – puts all the compiled parts together and creates (builds) an executable (.apk or .aar file)
APK stands for Android Package Kit and is a file extension format for distribution and installing Android applications, it contains all the elements that an app needs to install correctly on your device. For example the featured app we will create in this book is called Pronto Task, so when it is complete it can be distributed as pronto_task.apk. As Android app sizes and supported screen sizes increase, Google has introduced a new Android app publishing format named Android App Bundle which defers the APK generation and signing to Google Play. What this means is that when you are ready to publish your app, you will generate a .aar file instead and submit that to the Play Store, and it will handle generating the APK file for you. Will cover both formats in Chapter 11.
Firebase is a suite of development tools, services, and awesomeness provided by Google to support and accelerate mobile app development, publishing, and monetization. Some Firebase product offering has a cost associated with them, however many of them are free and most modern mobile application will benefit from at least one Firebase product. We will cover how to connect to Firebase in Chapter 12.
Android Studio Install and Setup
Android Studio is the primary tool used to create native Android apps. Android Studio is an Integrated Development Environment (IDE) which is a software suite that consolidates basic tools required to write and test software. In simpler terms, Android Studio (IDEs in general) is software used to create other software. Android Studio is created by a company called JetBrains and has been adopted by Google as the official development environment for Android since 2013.
Android Studio is a suite of many software tools which include Code Editor, Visual Layout Editor, Android SDK, and many more. The strength of Android Studio is that these tools are integrated, they work well with each other, so you do not have to install them separately. It is not an understatement to say that Android Studio is complex software, and the first step in understanding this tool is to install it.
Installing Android Studio
It is relatively simple to install Android Studio. Having said that, let me mention these three tips to help you learn new programming concepts.
● Always read the manual.
● Attempt it, figure it out.
● Ask questions, get unstuck
Most programming tools and libraries come with a guide or manual which if you follow will guide you towards results. This is true for Android Studio, the downloadable file, and the instructions to install Android Studio and beginner tutorial can be found on https://developer.android.com/studio
Android Studio can be installed on Windows, Mac, Linus, and Chrome OS computers. Make sure that your computer meets the minimum system requirement outlined on the link above. Most modern standard laptops and/or desktop computers should meet the minimum standard for installing Android Studio and developing Android apps.
Follow the installation guide for your operating system which can be found on https://developer.android.com/studio/install
Android Studio First Time Setup
Once the Android Studio installation is complete, you need to launch so you can complete the first-time setup. Once you start Android Studio, you will be presented with the following screens:
- Splash Screen – this appears for a few seconds while Android Studio loads.
- Import Settings – this allows you to import settings from previous instances of Android Studio installed on your computer if any. If this is your first time, then you will want to select Do not import settings.
- Data Sharing – make your choice as you see fit, there is no personally identifiable data being shared.
- Welcome screen – mostly information, click on next.
- Install Type – select standard, unless you have an explicit constraint that requires custom.
- Select UI Theme – options include Dracula (dark), light, and high contrast. Pick one.
- Verify Settings – review your changes, take note of how much more needs to be downloaded, ensure you have enough storage, and click next.
- Emulator Settings – if your hardware supports direct emulation, you might see another screen.
- Downloading Components – Android Studio Setup Wizard will not kick off the download of required components, this will take a few minutes depending on your internet connection.
- Complete Setup – Once the setup wizard is done you will see the entry “Android SDK is up to date”. At this point, you can click on Finish to exit the setup and be presented with the welcome screen like the one shown in Figure 1.3
When you see this screen, congrats, you have successfully installed Android Studio and we are ready to take for a drive.
This post brought to you a whirlwind introduction to Android development. In the book, I showed a quick walkthrough to create your first Android app aka Hello World. I understand it is a lot to unpack for an introductory chapter. I wish it could be simpler, but the fact is that the field of programming in general and Android development, in particular, is synonymous with complexity. So you are better served to hit the ground juggling the terms and concepts that will become part of your vocabulary going forward.
Android Studio will be your new playground so in this chapter we went through a concise introduction to Android Studio, we saw that Android Studio is a collection of integrated software tools. One of the main components of Android Studio is the Code Editor used to write and edit source code. Virtual devices are a substitute for real Android devices when developing Android apps. You also got introduced to the featured app for this book called Pronto Task which we will create using Android’s new UI toolkit called JetPack Compose which uses Kotlin to create Android User Interfaces. So in essence, for the rest of the book, we will be learning about Kotlin programming language starting with the next chapter.