Best Android Interview Questions to Prepare With in 2022

By | October 22, 2021
Android Interview Questions

These days everyone is aware of Android because it is everywhere. It has a huge market all over the globe. Google, the parent company of Android, hires developers from across the world to develop Android further. Android flaunts a seemingly infinite number of applications on the Play Store, promising a bright future for Android developers. This article discusses some of the best Android interview questions.

Many tech and non-tech companies are releasing their own Android applications to increase their reach in the market. Having an Android application these days has become as important for a business as having a company website. At present, Android dominates the smartphone market, with more than 70% of active mobile users using Android.

Vamware

If you are an Android developer and preparing for an upcoming interview, we suggest you go through these best Android interview questions, so you can ace the interview and get the job you want.

Android Interview Questions

These are the best Android interview questions that will give you an idea about the type of questions you might face during an Android-based interview. So, let’s start.’

Basic Android Interview questions

Question No. 1: What is Android?

Answer: Android is an open-source operating system primarily for mobile devices, such as smartphones and tablets, and it is based on the Linux Kernel.

Question No. 2: Name the latest version of Android?

Answer: Android 12.0 is the latest version of Android that came out in October 2021. 

Question No. 3: Name all the Android versions?

Answer: All Android versions are named alphabetically and on the name of some dessert. The following table enumerates the various Android versions and their names:

Android Version Android Name Release
12.0 Snow Cone 2021
11.0 R 2020
10.0 Q 2019
9.0 Pie 2018
8.0-8.1 Oreo 2017
7.0 – 7.1.2 Nougat 2016
6.0 – 6.0.1 Marshmallow 2015
5.0 – 5.1.1 Lollipop 2014
4.4 – 4.4.4 KitKat 2013
4.1 – 4.3.1 Jelly Bean 2012
4.0 – 4.0.4 Ice Cream Sandwich 2011
3.0 – 3.2.6 Honeycomb 2011
2.3 – 2.3.7 Gingerbread 2010
2.2 – 2.2.3 Froyo 1010
2.0-2.1 Eclair 2009
1.6 Doughnut 2009
1.5 Android Cupcake 2009

Question No. 4: What is the Android SDK?

Answer: Android SDK (Software Development Kit) is a suite of development tools to create applications for the Android platform. It is now known as Android Studio. Basically, it is used to emulate an Android environment. This is a very handy tool to develop and test how your Android application will run on Android devices.

Question No. 5: Name the Android application components.

Answer: The various Android application components are:

  • Activities
  • Services
  • Intent
  • Resource Externalization
  • Notification
  • Content Provider

Question No. 6: Give some advantages of Android.

Answer: There are several advantages of using Android, some of the best among which are:

  • It is an open-source platform.
  • Android is platform-independent.
  • It supports various plugins, like camera, Bluetooth, Wi-Fi, and speech recognition.
  • It has highly optimized virtual machines.

Question No. 7: Which programming languages are supported by Android?

Answer: In 2019, Google announced Kotlin as the official language for Android development. Before that, there was no official language for Android, and developers used Java to develop Android applications. Therefore, Android supports both Java and Kotlin.

Question No. 8: What is .APK?

Answer: .APK (Android Application Package) is the android app file extension. It is a compressed file format that contains all the application code, resource files, certificates, and other files. All the application files are compressed into a single file so that distribution and installation become easy.

Question No. 9: What is an activity?

Answer: An activity is defined as the GUI of a single screen that performs an action on the screen. A complete Android application is made up of many activities. For example, if we create an email Android application, its inbox and draft interfaces will be distinct activities.

Question No. 10: Name all the Android Architecture layers.

Answer:

  • Linux Kernel
  • Libraries
  • Android Libraries
  • Android Runtime
  • Application Framework
  • Application

Question No. 11: What is an Android framework?

Answer: An Android framework is a collection of pre-built APIs that allows developers to build robust Android applications quickly and efficiently. An Android framework consists of various tools, including UI designing tools and system tools.

Question No. 12: Do all mobile devices support the latest Android version?

Answer: There are some limited mobile devices in the market that support up-gradation to the latest version of the operating system. The main reason why every device does not get the latest version is because of its hardware specification.

Intermediate Android Interview questions

Question No. 13: What does the Application Framework do in Android Architecture?

Answer: It is one of the most important layers of Android architecture that provides many high-level services to the application in the form of Java classes. Some of these services are Activity Manager, Content Provider, Resource Manager, Notification Manager, and View System.

Question No. 14: Why can’t we run Java byte code on Android?

Answer: Android has DVM (Dalvik Virtual Machine) and not JVM (Java Virtual Machine), and to run Java byte code, we need JVM.

Question No. 15: What happens to the activity when a user rotates the screen?

Answer: When the user rotates the screen, the instance of the current activity gets terminated, and a new instance gets created simultaneously.

Question No. 16: What is the difference between File, Class, and Activity in Android?

Answer: A file stores information, while a class holds some functionality, and it compiles from the java source file so the Android can use its functionality. An activity, on the other hand, is a view or a user interface that allows a user to avail the functionality of a class.

Question No. 17: What are containers?

Answer: Containers, as the name itself implies, hold objects and widgets together depending on the specific, required items and the particular arrangement that is required. Containers may hold labels, fields, buttons, or even child containers.

Question No. 18: Name the tools present in Google SDK.

Answer: Following are the various tools that are part of the Google SDK:

  • Android Emulator.
  • DDMS – Dalvik Debug Monitoring Services.
  • AAPT – Android Assets Packaging Tool.
  • ADB- Android Debug Bridge.

Question No. 19: What is an ANR?

Answer: ANR stands for Application Not Responding. It is used when the application’s main activity stops responding for a while. It depends on some conditions, like if there is no response to input after 5 seconds or the broadcast receiver is not done executing within 10 seconds.

Question No. 20: What is AAPT?

Answer: AAPT stands for Android Asset Packaging Tool. It is a tool that is part of the Google SDK, and it helps the developer to handle zip-compatible archives, i.e., create, extract and view the contents.

Question No. 21: How do we pass data to sub-activities?

Answer: We use HashMaps-like structures, such as Bundles, to pass trivial data from one activity to its sub-activities.

Question No. 22: Why is WebView, and why do we use it in Android?

Answer: WebView is a window or view that displays web pages inside an Android application. It gives a web-browser-like look to the application. WebView uses the WebKit rendering engine to display web pages, and it also includes some navigation tools like forward, backward, and history buttons.

Question No. 23: What is Context?

Answer: Context is a class that handles the current state of a running Android application. It provides services like resolving resources and accessing the database. There are two types of Context:

  1. Application Context
  2. Activity Context

Question No. 24: Define content provider.

The content provider provides data from one application to another upon making a request. It manages the structured set of data and also provides data security.

Question No. 25: Name the different storage methods in Android.

Answer: Android has a number of storage methods. These are:

  • Shared Preferences
  • Internal Storage
  • External Storage
  • SQLite Databases

Question No. 26: Can we run JAR files on Android?

Answer: No, it is not possible to run JAR files on Android. However, we can compress the same into Android Packages (.apk) with the help of Asset Packaging Tool (APT) and then run them on Android.

Question No. 27: What is a fragment?

Answer: A fragment is a modular form of activity, and it can also be understood as a part of the activity that can combine with other fragments in a single activity, which makes it reusable.

Question No. 28: List some differences between service and thread.

Answer: 

Service Thread
It is similar to an activity without an interface. It is a concurrent execution of units.
A service runs in the background until it gets stopped explicitly. A thread runs with the same process when the application runs.
If an application stops executing, it is not necessary that the service will also stop its execution. If an application gets killed, then its threads also get killed.
One application service can be exposed or used by another application. To use threads, Google has introduced handler and looper into Android threads.

Question No. 29: List the datatypes supported by AIDL.

Answer:

  • String
  • Map
  • List
  • CharSequence
  • All primitive Java data types (int, long, char, and boolean)

Question No. 30: What does orientation do in Android?

Answer: Orientation is an activity that represents the layout of a screen display in the form of rows and columns.

Syntax:

<activity android name=".activity" android: screenOrientation="landscape">

Question No. 31: Can we add a fragment without a user interface?

Answer: Yes, we can use the add(fragment, string) method to add a fragment from the activity.

Android Advance interview questions

Question No. 32: Explain the lifecycle of an Android Activity.

Answer:

  • onCreate(): The activity is created with the first interface.
  • onStart(): It is summoned when the activity gets visible to the user.
  • onResume(): When the user interacts with the activity, this method comes into action.
  • onPause(): This method becomes active when the activity is running in the background.
  • onStop(): This method starts execution when the activity is hidden from the user.
  • onDestroy(): This method is called when we need to terminate the activity.
  • onStart(): It stops the current activity and brings back the starting activity.

Question No. 33: What is intent in Android?

Answer: Intent, a.k.a. intention, is used to perform actions. It is an object that sends a message to other components of the application and requests some action. There are two types of intent:

  1. Implicit Intent – In implicit intent, the application decides the component to target based on the evaluated data.
  2. Explicit Intent – In explicit intent, the application decides the component of some other application to target.

Question No. 34: What is the difference between implicit and explicit intents?

Answer: Implicit intent is used when a user performs an action. For example, sending a message and dialing a number on the dial pad. Explicit intent, on the contrary, helps the user to move from one activity to the other.

Question No. 35: How can we clear the back stack of activities when a new instance of an activity is called?

Answer: We can use the FLAG_ACTIVITY_CLEAR_TOP flag or FLAG_ACTIVITY_CLEAR_TASK and FLAG_ACTIVITY_NEW_TASK in conjunction to do so.

Question No. 36: What is the role of DVM (Dalvik Virtual Machine) in Android?

Answer: Dalvik is a virtual machine in Android that executes the code and runs the application. It can also execute multiple virtual machines.

Question No. 37: Give the difference between Android Service and Intent Service.

Answer: Android Service performs an operation in the background, such as playing music, but it does not provide any user interface. On the other hand, Intent Service is used to handle on-demand asynchronous requests.

Question No. 38: What do you know about toast in android?

Answer: Toasts are simple popup messages that provide feedback about the current operation. A toast is useful when there is an ongoing process, and we want to show the processing message without affecting the current activity and display.

Example:

val text = "Sending Text"
val toast = Toast.makeText(applicationContext, text,20)
toast.show()

 

Question No. 39: What do you know about broadcast receivers?

Answer: Broadcast receivers are used to respond to the broadcast messages sent from the other applications or the system itself. An application can receive broadcast via two methods:

  1. Manifest-declared receivers
  2. Context-registered receivers
BroadcastReceiver br = new MyBroadcastReceiver();

Question No. 40: Explain the various important files and folders that we use when we create a new android app. 

Answer: 

  1. app (directory): It is the project or root directory that contains all the files and folders of the application
  2. java: It is the subdirectory of the app directory, and it contains all the .java  source code files of the project. It also contains the default MainActivity.java source file that has an activity class that runs when the app is launched by the user.
  3. res: This directory contains the UI files of the app. It has 3 main subfolders
    1. res/drawable-hdpi for draable object for high-density screen
    2. res/layout for the user interface files
    3. res/values for the other files like XML that contain resources information
  4. Gradle Script: It is an auto-generated directory that contains files like build.gradle, compileSdkVersion, buildToolsVersion, applicationId, minSdkVersion, targetSdkVersion, versionCode, and versionName.

Question No. 41: What do you know about sticky intent?

Answer: Sticky intents are used with sticky broadcasts, and a sticky intent stays with the Android system for future broadcast receiver requests. To perform a sticky intent, we use the sendStickyBroadcast() method. It got its name because the intent will be available even after the broadcast is complete.

Question No. 42: What is the difference between an activity and a fragment?

Answer: An activity can be treated as a signal that deals with operations performed by the user, such as dialing a number, clicking a picture, and sending an email. A fragment, on the contrary, is a modular part of the activity, and it has its own lifecycle with input events. A fragment gets affected by its parent activity.

Question No. 43: Why is it recommended not to change the application name after deployment?

Answer: We can change the application name whenever we feel so. However, in the development and deployment processes, doing so is not recommended because it can affect some of the application functionality that could result in application failure and breaking of the app.

Question No. 44: What is DDMS?

Answer: It is a debugging tool offered by Google SDK, and it stands for Dalvik Debug Monitor Server. DDMS offers the following features:

  • Logcat
  • Incoming call and SMS spoofing
  • Local data spoofing
  • Network traffic tracking
  • Thread and heap information
  • Screen capture device


Question No. 45: What do you know about ART?

Answer: Android Runtime, a.k.a. ART, is a runtime environment used by the Android application and services. Similar to its predecessor Dalvik, ART was designed especially for Android projects. It is capable of executing the Dalvik Executable format and the Dex bytecode specification. ART is well compatible with Dalvik, so applications written for Dalvik can also run with ART.

Question No. 46: List some importance of using emulators.

Answer:

  • Emulators help the developer to play around with the application interface and get an idea about how the application will work on an actual device.
  • These help in debugging and code testing.
  • An emulator is the proper testing ground for testing and development.

Question No. 47: List the states of activity.

Answer: When there is a change in configuration, the state of activity changes too. The activity gets created and destroyed according to the triggered events. Here is the list of major activity states:

  • Active: When there is an ongoing activity performing.
  • Pause: Activity is running in the background and still visible to the user.
  • Stopped: When an activity is obscured by another.
  • Destroyed: In this state, the activity is killed.

Question No. 48: What is a dialog and name the dialog box supported by Android?

Answer: It is a prompt window that allows the user to enter some additional information. A dialog window does not cover the screen completely and simply provides a small popup-like window for decision and input entry. Android provides support for the following types of dialog boxes:

  • Alert Dialog: An alert dialog box can have 0 to 3 buttons and include checkbox and radio buttons.
  • Process Dialog: It is used in the process bar. The brightness controller in Android devices is an example of a process dialog.
  • Date Picker Dialog: This dialog box prompts the date window.
  • Time Picker Dialog: It is an extension of DatePickerDialog to select the time.

Question No. 49: Name the exceptions in Android.

Answer: Exceptions are the errors that occur in the program due to some ill-logical code. Following are the various exceptions in Android:

  • InflateException: This exception occurs if there is an error condition.
  • Surface.OutOfResourceException: This exception rises if the surface is not created or resized.
  • SurfaeHolder.BadSurfaceTypeException: The .lockCanvas() method can throw this exception.
  • WindowManager.BadTokenException: This exception occurs due to invalid WindowManager.LayoutParamstoken.

Conclusion

With this, we have completed the end of our top Android interview questions. We hope you like this article, and you get to know something new. If you have ever been in an Android job interview, please comment down the Android interview technical questions you faced during the interview, and we will try to answer them. We hope these Android questions help you to crack the interview. If you like this article or have any suggestions, please let us know by commenting down below.

People are also reading:

Leave a Reply

Your email address will not be published. Required fields are marked *