According to early latest data figures, Android commands 63.6 percent of the mobile/tablet operating system market, almost twice the market share of Apple’s iOS. That makes the Android OS serious business indeed, so it’s a good time for Android software developers. But for those who’ve been called for interview, Android interview questions are of a highly technical nature, designed to test your skills and knowledge to the full.
Software development for Android applications is most often in Java, using the Android software development kit (SDK). While other development environments are available, job candidates who wish to be ready for whatever is thrown at them in interviews would be wise to focus their research on anticipated Android interview questions in general, and Java interview questions in particular.
And after checking out our list of Android interview questions below, sourced from the numerous developers who share and discuss these questions online, it’s also a good idea to source a good Android interview questions guidebook. These include 100 Questions & Answers To Help You Land Your Dream Android Job by Enrique López Mañas or the Java-focused Java Interview Guide: How to Build Confidence With a Solid Understanding of Core Java Principles by Anthony DePalma and Ayesha Khan.
Image Source: Amazon
Check Price >
8 Android Interview Questions
To help you prepare for the toughest Android interview questions you will face, here are 8 of the most common Android interview questions that can really stump candidates who are not prepared. The questions come complete with answers, posted online by experts. Good luck, Android AGENTs!
1. What is Android?
Michael Dorf provides this at the top of his list of top 10 most common Android interview questions because, believe it or not, it’s one that can really trip up a lot of interviewees. It shows the importance of knowing your skills inside and out, and not stumbling over what should be pretty basic information.
Michael advises interviewees to be precise in response, and to resist going into too much extraneous detail. His suggested answer is: Android is a Linux-based mobile operating system that allows developers to create applications that can perform basic and advanced functions for a user.
2. Can you describe the core building blocks of an Android application
Upwork.com identifies top-level Android interview questions such as these as “a great way to warm up the developer and get a feel for how well they understand the basics of building an Android app”. The website describes the following core building blocks of an application:
- Activity: An activity is a subclass of the “ContextThemeWrapper” class. Since almost all activities interact directly with the user, it is often helpful to think of an activity as the screen for a particular action, such as logging in or taking a picture.
- View: The view is everything you can see on the screen of the app—think of the individual UI elements like buttons, labels, and text fields.
- Intent: The main purpose of intent is to invoke individual components. Common uses include starting the service, launching activities, displaying a list of contacts, dialing a phone number, or displaying a web page.
- Service: A service is a background process that can either be local or remote. Local services may be accessed from within the application while remote services are intended to be used by other applications running on the same device.
- Content Provider: Content providers share data between applications.
- Fragment: Fragments are best thought of as parts of an activity—you can display more than one fragment on the screen at the same time.
- Android Manifest: The AndroidManifest.xml file provides essential information about your app required for it to run on the Android operating system. All Android apps have this file in their root directory.
3. What is the manifest file and how is it used?
Software developer Hari Kishan told Quora readers that this is one of the most common Android interview questions, as it effectively pinpoints candidates who know their stuff thoroughly. You either know it, or you do not.
Answer: Every Android app must have this manifest file in its root directory named ‘AndroidManifest.xml’. The file includes critical information about the app, including the Java package name for the application.
Bonus follow up question: What is the first element in the AndroidManifest file, right after the encoding declaration?
Answer: ‘manifest’ Note: The ‘permissions’ element is the next best answer if the developer assumed you meant the first element within the ‘manifest’ structure.
4. List and explain the use of Java classes related to the use of sensors on the Android platform.
Toptal.com identifies four Java classes related to the use of sensors on the Android platform.
- Sensor: Provides methods to identify which capabilities are available for a specific sensor.
- SensorManager: Provides methods for registering sensor event listeners and calibrating sensors.
- SensorEvent: Provides raw sensor data, including information regarding accuracy.
- SensorEventListener: Interface that defines callback methods that will receive sensor event notifications
Toptal also recommends reading up the Sensors overview on the Android Developers Guide.
5. What is ANR?
Software developer Hari Kishan tells Quora that ANR stands for ‘Application Not Responding’, a dialog box that appears when an application doesn’t respond, typically for more than 10 seconds, but sometimes fewer. ANR offers the user the option of closing the app or waiting for it to finish running.
A follow-up question here is how ANRs are avoided, and Hari advises a number of possible answers. The best answers will indicate a reluctance to work off the main thread, the ‘UI thread’. That is the core single thread that your application runs on, and you’d want to keep activities requiring more complex computations or network and database connections, on separate worker threads so as not to slow down the main thread.
6. Explain the Platform architecture of Android
By way of explaining the answer to this questions, Android developer Shri Ram shared the following YouTube video of an app that he developed to detail the best responses to the Android interview questions that might be expected of a candidate who has been in programming for two years.
Here is a transcript of the answer to the question above:
Android is an open-source Linux-based software stack, comprising Linux Kernal, Hardware Abstraction Layer, Native Libraries, Android RunTime, Java APIs, and System Apps.
Below Of Stack is the Linux Kernel, which provides drivers for connecting to hardware.
The hardware abstraction layer (HAL) , provides standard interfaces that interact with Kernal drivers to access hardware features.
Android Run Time is written to run multiple virtual machines on low-memory devices by executing DEX files.
For devices running Android version 5.0 (API level 21) or higher, each app runs in its own process and with its own instance of the Android Runtime (ART).
Prior to Android version 5.0 (API level 21), Dalvik was the Android runtime
Android components such as ART and HAL are built from native code, requiring native libraries written in C and C++. Android provides Java APIs to use functionality of native libraries to apps.
Java APIs form the building blocks you need to create Android apps by providing components and services.
Android also comes with a set of core system apps, for email, SMS messaging, calendars, internet browsing, contacts, and more.
7. Explain the life cycle of an application development process you worked on previously.
Identified by CA-Android.Blogspot.ie as typical of the Android Interview Questions that are asked of more senior employees. According to the website, such questions are less about your knowledge of such things as the “difference between abstract class and interface”, and more about your all-round technical acumen, collaboration and communication skills.
With the question above, what the interviewer is seeking is an answer that communicates the requirements of the development process, the planning, modelling and construction, and the deployment on the back end.
8. A Coding Trouble-Shooting Test
Toptal provides the following, which is typical of the Android interview questions that might be expected in a technical round.
Under what condition could the code sample below crash your application? How would you modify the code to avoid this potential problem? Explain your answer.
Intent sendIntent = new Intent(); sendIntent.setAction(Intent.ACTION_SEND); sendIntent.putExtra(Intent.EXTRA_TEXT, textMessage); sendIntent.setType(HTTP.PLAIN_TEXT_TYPE); // "text/plain" MIME type startActivity(sendIntent);
An implicit intent specifies an action that can invoke any app on the device able to perform the action. Using an implicit intent is useful when your app cannot perform the action, but other apps probably can. If there is more than one application registered that can handle this request, the user will be prompted to select which one to use.
However, it is possible that there are no applications that can handle your intent. In this case, your application will crash when you invoke startActivity(). To avoid this, before calling startActivity() you should first verify that there is at least one application registered in the system that can handle the intent. To do this use resolveActivity() on your intent object:
// Verify that there are applications registered to handle this intent // (resolveActivity returns null if none are registered) if (sendIntent.resolveActivity(getPackageManager()) != null) { startActivity(sendIntent); }
Toptal also advises consultation with the Android developer’s guide for additional information about implicit intents.