Top 32 Android Interview Questions and Answers
Product Buildingby Marta Kuzma , 25 October 2022
With its open-source mobile operating system, Android has quickly become the top platform for application development, leaving Android developers like you in high demand.
Whether you’re a seasoned developer or just looking to start your Android app development career, we’ve compiled 32 Android interview questions and answers to crush your next interview.
Let’s dive in.
1. What is Android?
Android is a kernel-based Linux system generally used on mobile devices and is platform-independent. As an open-source operating system, it requires no license or fees for development or distribution.
2. What database is used for Android?
The built-in database implementation for Android is the open-source, relational SQLite database. The software library of SQLite implements a fast, self-contained SQL database engine, which makes it an excellent complement for mobile development.
3. What is Android Architecture?
Five components comprise the patterns and techniques used to design and build an Android application:
Linux Kernel is responsible for all major functions of the hardware, memory and power management, and access to resources. Think of this as the foundation.
Libraries are collections of code created by developers and available for your use in development.
Android Runtime (ART) is responsible for translating bytecode, the application runtime environment a software layer between the operating system and application. ART executes both the Dalvik Executable format and Dex bytecode specification.
Android Framework: If the kernel is the foundation, the Android Framework is the wireframe of the structure, containing classes to create an application. These classes are to be enriched further with functionality, graphics, and features.
Android Applications are the complete applications, as seen on the device, such as your SMS app.
4. What tools do you need to develop an Android app?
There are several tools you can use to build an Android mobile application. The Android SDK (Software Development Kit) is a toolset that contains the basic tools needed to start. In the Android SDK, you’ll find:
Android Emulator to simulate devices
Dalvik Debug Monitoring Services (DDMS) to debug the code
Android Debug Bridge (ADB) to facilitate command-line communication with the emulator
Android Asset Packaging Tool (AAPT) to view, update, and make archives
Android Studio is the preferred and official integrated development environment for Android programming.
5. What languages does Android use?
Java and Kotlin are the most popular languages for Android developers, though C++, C#, and Python also work. Due to Android’s flexibility, other languages can also be converted through various frameworks or tools.
6. What does a ContentProvider do?
A ContentProvider provides content to applications. The ContentProvider is a system for data security and is only needed if data in the application will be shared with other apps.
7. What is the difference between explicit intent and implicit intent?
Intent is the communication process between the isolated components of the mobile app and the device. An example of a method used to communicate intent is startActivity() which starts an activity.
Implicit Intents do not directly specify what components should be called; it only specifies the action to perform. These intents rely on the Android system to check which components perform that action.
Explicit Intents are used when you know what new activity class needs to be performed. They allow for more control and are typically used within the application.
8. What is the difference between Serializable and Parcelable?
Serializable comes from Java. If an object is marked Serialized, Java will automatically serialize it by converting it to a stream, but the process creates garbage objects.
Parcelable is Android-specific and far more efficient than Serializable; however, since you must implement the serialization manually, it is a longer process.
9. What are intent filters?
Intent filters are part of an app's manifest file and define the type of intents that the component would like to receive. Used with implicit intent, the Android system takes the contents of the intent and compares it to the intent filters. The intent filters receive, respond, and sift the user inputs to return the following appropriate action.
10. What is a component, and what are the components of an Android application?
Components are building blocks of an Android app, with an entry point for the system or a user. The components of Android applications are:
Services: A general-purpose entry point. They keep apps running in the background.
Activities: An entry point for interacting with the user.
Broadcast Receivers: A well-defined entry that delivers events to the app even if the app is not running.
Content Providers: A component that shares data with other apps if the proper permissions are allowed.
11. Explain the lifecycle of an Android activity.
There is a core set of 6 callbacks in the activity lifecycle stages, including:
onCreate() — The basic application startup logic that the system creates the first time there is app activity.
onStart() — This callback prepares the app to enter the foreground and allows the user to interact with it.
onResume() — The app and the user interact on this call, and the app will stay here until the user shifts attention away from the app.
onPause() — When the app is no longer in the foreground, this method is called to indicate the user is leaving your app’s activity.
onStop() — The activity is no longer visible to the user and is about to be terminated in this part of the lifecycle.
onDestroy() — In this state, components linked to the activity's lifecycle will receive the ON_DESTROY event. This method is called when the activity is finishing, or a configuration change occurs.
One should use a ViewModel object to determine why it is being destroyed.
12. What is the difference between the AOSP and Stock Android?
Android Open Source Project (AOSP) and stock Android are two very similar versions of Android. In fact, AOSP was once considered “Stock Android” until Google started making their own smartphones and devices.
Nowadays, Stock Android is the version of Android that includes the suite of Google apps like the Play Store and Gmail.
AOSP is a basic version of Android, with no frills or added extra bloatware. It also lacks any additional features. It’s often called “Vanilla Android” because it is so simple, but still a staple.
13. What is a limitation of Android compared to iOS?
Apple’s Swift proprietary language was created for app development, making learning to create apps faster for new developers than learning the languages used for Android.
Android developers run into compatibility issues since so many manufacturers create Android devices. Android developers have a host of screen sizes, parameters, and versions to code for.
iOS developers have the advantage of programming their apps for a smaller set of devices and only a handful of different screen sizes. This makes it easier for iOS developers to have a consistent and functional user interface across all of them.
14. What are the different ways to create a notification?
Status Bar Notification: on the top bar of the device
Notification Drawer Notification: appears in the drop-down of the device
Heads-Up Notification: overlays on the screen
Lock-Screen Notification: appears when your phone is locked
15. How would you address an Application Not Responding (ANR) error?
If the application is published, the best thing to do is check the Android vitals log for insight as to why the application’s UI is blocked.
StrictMode can detect I/O incidents that need fixing, and Traceview helps identify where a thread is busy. A final option is to use Android Debug Bridge (ADB) as root to pull a trace file.
16. Explain the AndroidManifest.xml’s purpose.
This XML file is necessary to report key information about the app to the Android build tools, Android operating system, and Google Play. This file is a dialog to communicate:
All components of the app, including activities, services, broadcast receivers, and content providers
Permissions the app needs
Required hardware and software features
The minimum API level required
17. Why is AIDL used?
The Android Interface Definition Language (AIDL) is used to break down objects into primitives. By breaking down objects, Android understands the requests so both the client and service can communicate with each other using interprocess communication (IPC).
18. What is an APK format?
APK stands for Android Package kit. The .apk file is a compilation of all the program’s visual assets, resource files, application code, and AndroidManifest.xml file. This is the file format that is uploaded to the Google Play store.
19. What is the Adapter in Android?
The adapter allows for access to data items in the app. It acts as a bridge between the data itself and an AdapterView.
20. What is JobScheduler?
To conserve device resources in Android 8.0, Android set limits on background executions. While these updates save battery and memory, this offers a solution for apps that need to perform a background job while not running.
The JobScheduler will have the system execute the task with the declared criteria met.
21. What are the important items for every Android project structure?
AndroidManifest.xml
build.xml
bin/
src/
res/
assets/
22. Why should a developer use Gradle?
Gradle automates the build process but still allows for flexible build configurations. It speeds up the app building process and has features to scan builds for changes and debugging.
23. Should you use Dalvik Virtual Machine?
No. Dalvik Virtual Machine was replaced in Android 5.0 by Android Runtime.
24. Define and compare processes vs. threads.
A process is used for a larger, more complex task, like executing an application. They have independent resources and can contain multiple threads. The components in an app should run in the same process.
The system will create an execution context upon starting an application, commonly referred to as a thread. Threads are designed for smaller tasks, can be managed independently, and share resources.
The main thread communicates with the Android UI Toolkit and sends events to the appropriate user interface widgets, including drawing events.
25. Why should you use Fragments while developing an Android app?
Fragments are bound to an activity. Fragments create better user interface design because they make it easier to modify an activity appearance at runtime. In simpler terms, fragments adapt to different Android device configurations.
26. Should you store sensitive data with SharedPreference security?
No. Anyone with root-level access to the device can see the SharedPreference data. Use it only for small amounts of primitive data. The data SharedPreference stores is key/value pairs to a file on the device and include String, int, float, and Boolean data types.
Sensitive data should be encrypted and the encryption key stored elsewhere.
27. What is the difference between ListView and RecyclerView?
ListView is the predecessor of RecycleView.
RecycleView improvements make it more flexible for different layouts and allows for cells to be reused during scrolling.
28. How do abstract classes differ from interfaces?
Interfaces are like empty frameworks that contain a pattern of only abstract methods. The subclasses provide the implementation for these methods.
Abstract classes allow concrete and abstract methods to define the class' behaviors. With an abstract class, you define the same or different behavior to be carried out among related objects.
29. What is a Drawable in Android programming?
According to Android, a Drawable resource is a general abstraction for something that can be drawn. An API is used to retrieve graphics such as bitmaps and nine-patch files from the src/ directory.
30. Why are Views important for User Interface?
Views are the boxes that respond to a user’s actions with the program. Views include:
TextView
EditText
Button
Image Button
Date Picker
RadioButton
CheckBox buttons
Image View
GroupViews are invisible containers that hold many Views and other ViewGroups. They are a superclass to Layouts.
31. Why is findViewById falling out of use?
Assigning an ID to an element in Android makes it easier to call the element later with findViewById.
While it can be useful, findViewById takes up many lines of code and recent updates to Android Studio’s Data Binding Library to assign text to the widget directly in the layout file. This simplifies the code and removes the need to use findViewById.
32. What sensors does Android have? How are they used?
Most Android devices are equipped with a number of built-in sensors. These sensors fall into 3 categories:
Motion Sensors
Position Sensors
Environmental Sensors
The Android sensors help create apps that respond to 3-dimensional device movement, like tilting your phone for a game, or changes in the environment, like automatic screen adjustments to light).
Ace your interview with thorough preparation.
Study these interview questions to have your Android know-how fresh before your next interview. As the market for Android apps continues to grow, developers are becoming more highly sought after.
Did you nail these Android Interview Questions? The next step is preparing for your technical interview or writing your job proposal to secure your new position.
Be aware that if you’re applying for a remote position, chances are high that your interview will be online or on the phone.
If you are still feeling nervous about your interview, Android offers training tutorials in their CodeLab.
Looking for your next position?
MVP Match makes your job search easier beyond this interview preparation. We’re here to help freelancers and job seekers connect with companies looking for skilled professionals. Join our freelance network to get on our roster and find your next gig.
We also help companies acquire top talent for their teams. MVP Match can curate a list of great developers for your next project, so you spend less time vetting applicants. Contact us if you’d like to take advantage of this valuable recruiting tool.