Looking to hire an Android developer? If you’re not an Android developer yourself, or if you’re an entrepreneur or startup founder who’s venturing into the world of hiring developers for the very first time, knowing what to ask can be a challenge. (If this is you, be sure to also check out our guide to hiring freelance developers).
We'll be sharing 18 Android interview questions and answers that'll put your developer to the ultimate test, while also getting some useful insight into their attitudes towards Android development. If you happen to be hiring a remote developer, be sure to also ask the 10 essential behavioral interview questions for freelancers.
Note: If you are an Android developer, we hope these questions will serve as good practice if you have an interview coming up, so that you'll know how your answers may be evaluated.
Let's jump right in, shall we?
An explicit intent is where you tell the system which Activity or system component it should use to respond to this intent. Implicit intents allow you to declare the action you want to perform; the Android system will then check which components are registered to handle that action.
Here, you’re looking for an understanding of when you should use each type of intent, as the vast majority of the time you’ll use explicit intents to start components in your own application, while implicit intents are most commonly used to communicate with components from other third party applications.
This is still a much-debated topic, but the code used to create an Activity is fundamentally more involved than the code used to create a Fragment. The old Activity has to be destroyed, paused or stopped, and a new Activity has to be created. The developer should acknowledge that the best practice is to only use Activities when you need to swap the entire screen, and use fragments everywhere else.
Bonus points if the Android developer mentions any of the following use cases, where you’ll almost always use a Fragment, rather than an Activity:
This question provides an insight into the app developer’s understanding of the lifecycle of dynamic fragments, as well as Fragment transactions, and the back stack.
If the "Back" button is going to return the user to the previous Fragment, then you’ll need to save each Fragment transaction to the back stack, by calling
addToBackStack() before you
commit() that transaction.
The developer definitely shouldn’t suggest creating a "Back" button specifically to handle navigating between fragments, but bonus points if they mention that you should never try to commit a FragmentTransaction after calling
onSaveInstanceState(), as this can result in an exception.
If you only need to override the
run() method and no other Thread methods, then you should implement Runnable.
In particular, be on the lookout for an Android developer demonstrating an understanding that you should only extend from a class when you need to modify some of its functionality.
ThreadPool consists of a task queue and a group of worker threads, which allows it to run multiple parallel instances of a task.
Here, you’re assessing the app developer’s understanding of how multithreading has the potential to improve an app’s performance, but also how it can negatively impact performance when used incorrectly.
Using ThreadPool is more efficient than having multiple operations waiting to run on a single thread, but it also helps you avoid the considerable overhead of creating and destroying a thread every time you require a worker thread.
An AsyncTask is not tied to the lifecycle of the Activity that contains it. If the Activity is destroyed and a new instance of the Activity is created, the AsyncTask won’t be destroyed. This can lead to a number of problems, but the major ones an Android developer should be aware of are:
The solution is to avoid using AsyncTasks for long-running background tasks.
Start by making sure your Android application has the necessary read access permissions. Then, get access to the ContentResolver object by calling
getContentResolver() on the Context object, and retrieving the data by constructing a query using
ContentResolver.query() method returns a Cursor, so you can retrieve data from each column using Cursor methods.
Accessing data is one of the tasks that’s most likely to block the main thread, so the developer should stress the importance of performing data queries on a separate thread.
Serializable is a standard Java interface that’s easy to integrate into your app, as it doesn’t require any methods. Despite being easy to implement, Serializable uses the Java reflection API, which makes it a slow process that creates lots of temporary objects.
Parcelable is optimized for Android, so it’s faster than Serializable. It’s also fully customizable, so you can be explicit about the serialization process, which results in less garbage objects.
While the developer may acknowledge that implementing Parcelable does require more work, the performance benefits mean that they should advise using Parcelable over Serialization, wherever possible.
Here, you’re checking that the Android eveloper understands that you need an additional component to connect an AdapterView (such as ListView or GridView), to an external data source. An Adapter acts as this bridge, and is also responsible for converting each data entry into a View that can then be added to the AdapterView.
This question checks whether the developer is aware of the golden rule of threading on Android: never perform lengthy or intensive operations on the main thread.
An ANR dialog appears when your UI has been unresponsive for more than 5 seconds, usually because you’ve blocked the main thread. To avoid encountering ANR errors, you should move as much work off the main thread as possible.
Learn more about common Android errors with our infographic.
This is a complex topic, so you’re only looking for a high-level overview of the steps involved. However, the developer should make it clear that you should always subclass the View that most closely resembles the custom component you want to create — very rarely would you extend the View class.
After extending your class, you need to complete the following steps:
Build types define properties that Gradle uses when building and packaging your Android app.
This question allows you to check that the developer can differentiate between product flavors, build variants, and build types, as these are very similar concepts that are a common source of confusion:
There are many differences between ListView and RecyclerView, but the Android developer should be aware of the following in particular:
There are a number of methods, but the ones that tend to have the most impact are:
You use Handler to communicate between threads, most commonly to pass an action from a background thread to Android’s main thread.
This question allows you to check that the developer understands another fundamental concept of multithreading in Android: you cannot update the UI from any thread other that the main thread.
onBind()to return your implementation of the Stub class.
The onCreate() method is called once during the Activity lifecycle, either when the application starts, or when the Activity has been destroyed and then recreated, for example during a configuration change.
The onStart() method is called whenever the Activity becomes visible to the user, typically after
Here, you’re looking for an understanding that you should always use the simplest layout possible for what you want to achieve, as FrameLayouts are designed to contain a single item, making them an efficient choice when you need to display a single View.
If you add multiple Views to a FrameLayout then it’ll stack them one above the other, so FrameLayouts are also useful if you need overlapping Views, for example if you’re implementing an overlay or a HUD element.
Technical interviews and screenings are a crucial part of hiring an app developer, whether it's a Android developer, an iOS developer, or any mobile app developer familiar with making apps for both operating systems. With these interview questions, you'll be able to properly vet your candidates' technical skills in Android development — even if you are not rehearsed with the technology.
For more general interview questions to kick-off your assessment, take a look at our interview questions for software engineers, with a mix of technical and behavioral interview questions. If you want to ask Java-specific interview questions, you can find those here. Good luck!
Have a good Android interview question that we missed? Let us know below!