Android Interview Questions and Answers

In this tutorial, you’ll learn Android-specific interview questions and answers. By Evana Margain Puig.

Leave a rating/review
Save for later
Share
You are currently viewing page 2 of 4 of this article. Click here to view the first page.

What Are Support Libraries?

Android Support Libraries are packages that contain code. They support a specific range of Android platform versions and sets of features. Most of these support libraries are now part of the androidx namespace. This is the recommended set of libraries to use.

What Is an Intent?

Intents are messaging objects that trigger actions from other components. These target components can include services and activities.

Explicit Intent

An explicit intent specifies a particular destination for fulfillment. You can direct your intent to an external app. But an explicit intent commonly targets another component within your app. When using an explicit intent, your code must provide the name of the target app or component.

Implicit Intent

An implicit intent does not specify the target component. Instead, it states an action to perform. The Android system directs the intent to an external app capable of fulfilling it. For example, if your app needs to send an email, the Android system will select options from the email apps installed on the device. The user can select the desired email app.

Intents can be as simple or as complex as you want. For more information, you can review our Android Intents Tutorial with Kotlin.

What Is Localization? How Do You Do It in Android?

Localization is the ability of an app to support multiple languages, time zones, currencies, number formats, etc. This allows you to distribute your app widely to different countries and populations. Your app can bundle its localization through using Android’s resource directory framework, which specifies items (strings, images, layouts…) for different locales.

We also have a detailed tutorial on this topic, Android Localization: Getting Started.

What Is Android Jetpack?

Jetpack is a suite of libraries released by Android in 2018. Jetpack’s libraries provide code that works across the many Android devices currently in use. This makes it easy for developers to adhere to best practices!

If you’re new to Android Jetpack, please see our tutorial Introduction to Android Jetpack for help.

Otherwise, let’s go check the most important libraries in Jetpack and the ones you may need in an interview.

What are Android Architecture Components?

Architecture Components are a collection of libraries included in Jetpack. They help you implement clean architecture in your app, based primarily on the MVVM (Model-View-ViewModel) pattern.

We have many tutorials on architecture components, but you can start with this one: Android Jetpack Architecture Components: Getting Started.

Android robot building with legos

What is Data Binding?

The Data binding library helps you bind UI components in your layouts to data sources in your app. It uses a declarative format.

For an explanation on how to use data binding, take a look at Data Binding in Android: Getting Started, by me! :]

What Is View Binding?

View binding replaces findViewById. It uses binding classes to do this. These classes contain references to all views that have an ID in the corresponding layout.

You can learn more about view binding in our View Binding Tutorial for Android: Getting Started.

What Is LiveData?

LiveData is an observable class. The advantage of LiveData over libraries like Rx is that it is lifecycle-aware. It only updates data in the STARTED or RESUMED state.

LiveData is closely related to coroutines, covered elsewhere in this article. If you want a better understanding of how everything works together, see our article Coroutines with Lifecycle and LiveData.

What Is Room?

Room is a persistence library built over SQLite to help you create databases more easily. Room uses caching to persist your app’s data locally. This provides the app with consistent data, regardless of internet connectivity.

What Is ViewModel?

ViewModel is a class that stores the data from your UI. Because it’s aware of the app’s lifecycle, ViewModel is able to persist UI data through configuration changes, such as screen rotations.

What Is the Navigation Component?

The navigation component is a framework that controls navigation within an Android app. It manages the back stack. It also handles functions with different controls, such as the app bar or drawers. The navigation component helps you provide a consistent user experience by enforcing established navigation principles.

Other Libraries

In the Android world, you’ll encounter many libraries in addition to those in Jetpack. Your interviewer may ask about these. Here are some of the most common:

  1. Libraries for network requests: Retrofit, GraphQL
  2. Libraries for images: Picasso
  3. Dependency Injection: Dagger
  4. Reactive Programming: RXJava and RXKotlin

Where Do You Organize Your Tests in Android?

When you create an Android Studio project, you create two directories for testing:

  1. The test directory is for unit tests that run locally. Usually, the JVM runs these tests.
  2. The androidTest directory is for tests that run on devices. You’ll use this directory for other kinds of tests, such as integration tests and end-to-end tests.

What Are Unit Tests? How Do You Do Them in Android?

Unit tests run locally. Since they aren’t run on a device, they don’t have access to any Android framework library. It’s possible to use libraries that allow you to call Android framework methods from unit tests, however these libraries substitute only simulate device behavior. The preferred libraries are either JUnit or Mockito.

The ability to design and implement unit testing is usually a requirement for mid-senior to senior levels. If you want to learn how to do this, here are some resources:

Understanding how to use either of these test libraries will be enough for interviews.

Instrumentation Tests

Instrumentation tests are quite similar to unit tests but depend on a device or simulator to run. Since instrumentation tests are run on device, you have access to the Android device libraries. The two libraries mentioned above, JUnit and Mockito, are also used for instrumentation tests.

UI Tests

UI tests simulate a user’s interactions with your UI. The most popular library for testing is Espresso. You can learn about UI testing in our tutorial
Espresso Testing and Screen Robots: Getting Started.