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. 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.
Top 50 Android Interview Questions and Answers
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. We have divided the list of frequently asked Android interview questions into three levels, namely basic Android interview questions, intermediate Android interview questions, and advanced Android interview questions.
Basic Android Interview Questions
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 .
2. Name the latest version of Android.
Answer: Android 12.0 is the latest version of Android that came out in October 2021.
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|
|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|
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.
5. Name the components of an Android application .
Answer: The various components of an Android application are:
- Resource Externalization
- Content Provider
6. Give some advantages of Android.
Answer: There are several advantages of using Android. Some of the best ones 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.
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 .
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.
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.
10. Name all the layers of the Android Architecture .
- Linux Kernel
- Android Libraries
- Android Runtime
- Application Framework
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.
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 and Answers
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.
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.
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.
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 that 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.
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.
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.
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 doesn't complete execution within 10 seconds.
20. What is AAPT?
Answer: AAPT stands for Android Asset Packaging Tool. It is a tool that is a part of the Google SDK, and it helps the developer to handle zip-compatible archives, i.e., create, extract and view the contents.
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.
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 forwarding, backward, and history buttons.
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:
- Application Context
- Activity Context
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.
25. Name the different storage methods in Android.
Answer: Android has several storage methods. These are:
- Shared Preferences
- Internal Storage
- External Storage
- SQLite Databases
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 the Asset Packaging Tool (APT) and then run them on Android.
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.
28. List some differences between service and 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.|
29. List the data types supported by AIDL.
- All primitive Java data types (int, long, char, and boolean)
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.
<activity android name=".activity" android: screenOrientation="landscape">
31. Can we add a fragment without a user interface?
Yes, we can use the
method to add a fragment from the activity.
Android Interview Questions for Senior Developer
32. Explain the lifecycle of an Android Activity.
- 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.
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:
- Implicit Intent - In implicit intent, the application decides the component to target based on the evaluated data.
- Explicit Intent - In explicit intent, the application decides the component of some other application to target.
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.
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 flag and FLAG_ACTIVITY_NEW_TASK flag in conjunction to do so.
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.
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.
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()
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:
- Manifest-declared receivers
- Context-registered receivers
BroadcastReceiver br = new MyBroadcastReceiver();
40. Explain the various important files and folders that we use when we create a new Android app.
- app (directory): It is the project or root directory that contains all the files and folders of the application.
It is the subdirectory of the app directory, and it contains all the
.javasource code files of the project. It also contains the default
MainActivity.javasource file that has an activity class that runs when the app is launched by the user.
This directory contains the UI files of the app. It has 3 main subfolders:
- res/drawable-hdpi for a drawable object for the high-density screen.
- res/layout for the user interface files.
- res/values for the other files like XML that contain resources information.
- Gradle Script: It is an auto-generated directory that contains files like build.gradle, compileSdkVersion, buildToolsVersion, applicationId, minSdkVersion, targetSdkVersion, versionCode, and versionName.
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.
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.
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.
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:
- Incoming call and SMS spoofing
- Local data spoofing
- Network traffic tracking
- Thread and heap information
- Screen capture device
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.
46. List some importance of using emulators.
- 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.
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.
48. What is a dialog? 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.
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 an invalid WindowManager.LayoutParamstoken.
50. What do you know about the .dex file?
Answer: Here, dex stands for Dalvik Executable File. The Dalvik Virtual Machine (DVM) compiles an Android program into a .dex file. Later, this .dex file is zipped into a .apk file on the device.
Here, we have reached the end of our list of the top Android interview questions. We hope you liked this article and you got 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 Comment on this Post