Android Interview Questions and Answers
In this tutorial, you’ll learn Android-specific interview questions and answers. By Evana Margain Puig.
Sign up/Sign in
With a free Kodeco account you can download source code, track your progress, bookmark, personalise your learner profile and more!
Create accountAlready a member of Kodeco? Sign in
Sign up/Sign in
With a free Kodeco account you can download source code, track your progress, bookmark, personalise your learner profile and more!
Create accountAlready a member of Kodeco? Sign in
Contents
Android Interview Questions and Answers
30 mins
- Getting Started
- Android
- What Is the Android Manifest?
- What Is the Gradle Build System?
- What Are Activities and Fragments?
- What Is the App Lifecycle?
- What are Configuration Changes and When Do They Happen?
- Design
- How Do You Manage Resources for Different Screen Sizes?
- What Are Layouts in Android?
- What Is a RecyclerView?
- What Are Support Libraries?
- What Is an Intent?
- What Is Localization? How Do You Do It in Android?
- What Is Android Jetpack?
- What are Android Architecture Components?
- Other Libraries
- Where Do You Organize Your Tests in Android?
- Kotlin
- What Are Coroutines?
- What Are Companion Objects?
- How and When Do You Use Nullables in Kotlin?
- How Do You Do Type Checking in Kotlin?
- How Do You Declare Switch Statements in Kotlin?
- What Is a Lambda Expression?
- When Is the Keyword it Used in Lambda Expressions?
- What Is a Class Extension?
- What Are Ranges in Kotlin?
- Object-Oriented Programming
- What Is Polymorphism?
- What Is the Difference Between a Class and an Object?
- What Are Data Classes?
- What Is Encapsulation?
- What Are Visibility Modifiers?
- Where to Go From Here?
Android is one of the most robust mobile operating systems out there. When you interview for a job as an Android Developer, the number of things you need to know may feel overwhelming. The purpose of this article is to guide you through the most common interview questions and answers. You’ll also find links to resources where you can learn more about each topic.
If you’re a candidate preparing for an interview, this tutorial is for you. By studying these questions, and using the links to dive into topics you’re less familiar with, you can look forward to a brilliant interview! And if you’re a recruiter, you’ll also find these questions helpful as you plan your next candidate interview.
Getting Started
Unlike most of the tutorials on this site, this one doesn’t have a project to download. This tutorial is all about theory, with code snippets to illustrate the concepts. The purpose is to prepare you for a comfortable and successful interview!
Now let’s get started!
Android
The first questions are specific to the Android platform.
What Is the Android Manifest?
The Android Manifest is an XML file that must be present in every Android app. It provides information about the app to surrounding systems. These include Android build tools, the Android OS and the Google Play Store.
The Manifest includes many types of information. The main ones are:
- Package name
- Components of the app, such as activities, fragments and services
- Permissions needed from the user
For more details, you can review the App Manifest Overview. This article is in the Android developers website.
What Is the Gradle Build System?
Android Studio uses Gradle for building apps. An Android plugin for Gradle compiles, builds and packages apps or libraries. Gradle files also include dependencies and their versions.
Gradle files, historically, use Groovy as their required language. However, since 2019, you can also use the Kotlin language to code Gradle files in Kotlin apps.
We have two great articles on Gradle. Take a look at both Gradle Tutorial for Android: Getting Started and Gradle Tips and Tricks for Android for a deeper dive.
What Are Activities and Fragments?
An activity is a single thing the user can do within your app. The activity class takes care of creating a window in which you place your UI. A fragment is a small piece of functionality within this activity.
Since 2018, Android recommends creating single-activity apps. An app should consist of fragments within a host activity
What Is the App Lifecycle?
For any Android interview, you should be able to explain the lifecycle of an app. When interviewers ask this question, they’re usually looking for familiarity with the activity’s six callbacks:
onCreate()
onStart()
onResume()
onPause()
onStop()
onDestroy()
You should be able to name each activity and describe what it does and why it’s important. If you’re not sure about these, you can review the article Understand the Activity Lifecycle, in the Android developers website.
What are Configuration Changes and When Do They Happen?
Configuration changes cause Android to restart the activity. They include changes to screen orientation, keyboard availability and multi-window mode. When a configuration change occurs, you must issue a call to onDestroy()
. You follow this with a call to onCreate()
.
This is a key design topic! You’ll want to mention ways to support configuration changes and persist data so you can rebuild your activity. One approach might be to use ViewModels, which you’ll cover later.
Design
As you’re thinking about your new app, you must give careful attention to your UI design. Android provides guidelines on both material design and quality design. These will help you build apps that meets users’ expectations for visual coherence and navigability.
What Is Material Design?
Material design is a design language that Google developed in 2014. It consists of the building blocks for your UI components. This language, and the design principles it embodies, are applicable to Android as well as other applications.
Google provides a detailed guide to material design in its Design guidance and code. You can review this guide while developing your apps.
We also have an introductory tutorial on this subject, An Introduction to Material Design with Kotlin. Check it out!
What Are Quality Guidelines?
Google also provides an extensive list of quality guidelines. You can use this list to ensure that your app adheres to current quality standards. If your app passes these tests, you can be sure it meets your users’ expectations for performance, stability, and security.
You can review the Android Quality Guidelines in the Quality guidelines page of the Android developers website.
How Do You Manage Resources for Different Screen Sizes?
Android devices come in a variety of sizes and resolutions. When you’re building your app, it’s important to decide which of the many models you will support. Once you’ve made this decision, there are three common approaches you can take to make sure your app supports all screen sizes:
- Use view dimensions.
- Create several layouts, depending on the screen.
- Provide your images and resources as bitmaps.
Of course, you may also use a combination of these approaches in your app.
The Android developers website covers this in detail in the article Support different screen sizes.
What Are Layouts in Android?
Layouts define the structure of the UI of an app. They consist of View
and ViewGroup
objects, arranged hierarchically. There are different types of layout:
- Constraint Layout
- Linear Layout
- Relative Layout
Because this is one of the most complex concepts in Android, we cover layouts in both a video course, Beginning Android Layouts, and a tutorial, ConstraintLayout Tutorial for Android: Getting Started. Please review them if you need a better understanding of this important subject!
What Is a RecyclerView?
Most apps out there contain at least one RecyclerView
, so it’s a key topic you should know. A RecyclerView
is a widget provided in the Android SDK. It’s used to display a list of elements. RecyclerView
is designed to display lists that don’t fit on one screen and require scrolling.
What is RecyclerView Adapter?
The RecyclerView
Adapter
tells the RecyclerView
what to display in each ViewHolder
.
What Kind of Layouts Can You Have for RecyclerViews?
When you create a RecyclerView
, you have the flexibility to define one of the following layout types.
- Linear Layout
- Grid Layout
There’s a lot the developer needs to know about RecyclerView
. If you need a refresher on this topic, take a look at our course Beginning RecyclerView.
The Android developers website also has a comprehensive article, Create a List with RecyclerView.