30 Android Interview Questions and Answers

avatar-image
Misna V.K.
Oct 28, 20237 minutes read
  1. Beginner Android interview questions
  2. Who were the founders of the Android operating system?
  3. Which is the latest version of Android? Can you name some popular Android versions?
  4. What is the Android SDK?
  5. Can you define the architecture of the Android OS.
  6. Which is the official programming language of Android application development?
  7. What is AAPT?
  8. What is an activity in Android?
  9. What are the main features of Android?
  10. Intermediate Android interview questions
  11. What is an activity creator in Android?
  12. What are Intents in Android?
  13. What are the different methods of an activity lifecycle?
  14. Can you describe the Android framework?
  15. What is a Toast in Android?
  16. What are the containers?
  17. What are the primary components of an Android project?
  18. What is a view in Android? Mention the XML syntax for creating a View.
  19. How will you identify view elements?
  20. Briefly differentiate between an activity, file and a class in Android.
  21. What is the importance of WebView in Android?
  22. Advanced Android Interview Questions
  23. What do you mean by ANR in Android? Can you avoid it?
  24. What is a 'Broadcast receiver' and how can you implement it?
  25. What are 'Explain services' in Android and what is the code to implement it?
  26. What are the java classes that are used along with sensors in Android?
  27. What are the popular use cases of an Intent?
  28. What is the difference between Serializable and Parcelable?
  29. What are some exceptions in Android?
  30. What is AIDL and how can you create a bounded service using it?
  31. What is a nine-patch image and a .png image?
  32. What is DDMS?
  33. Is it possible for two Android applications to share the same LINUX ID?
  34. Tips to ace Android developer interview questions

With mobile phones becoming a necessity, Android has become irreplaceable in terms of mobile tech. Android application developers are in huge demand today, making it a desired field.

This blog is for everyone preparing for an Android interview. Here are 30 Android interview questions and answers that will help you land your dream job.

The blog is divided into 4 main categories –

  • Beginner android interview questions
  • Intermediate android interview questions
  • Advanced android interview questions
  • Tips to ace Android developer interview questions

Beginner Android interview questions

Here are some Android interview questions for beginners.

Who were the founders of the Android operating system?

Android was found by three developers — Andy Rubin, Rich Miner, and Nick Sears.

Which is the latest version of Android? Can you name some popular Android versions?

The latest version of Android is Android 9.0 called Pie. This version was released in August 2018.

All Android versions are named after desserts. The popular versions of Android are KitKat, Lollipop, Marshmallow, Nougat, and Oreo.

Note: The latest android version may change with time. Make sure you are up-to date about the lastest Android version.

What is the Android SDK?

The Google Android SDK is a set of tools that are used by developers to build applications for the Android platform. The SDK consists of:

  • Libraries
  • Debugger
  • Sample source code
  • Code emulator
  • Tutorials for Android OS
  • Documentation for the Android application program interfaces (APIs)

You can use the SDK to write code for the applications using the command prompt. But the popular method of coding is by using an IDE (Integrated Development Environment). For Android, the recommended IDE is Eclipse.

Can you define the architecture of the Android OS.

The architectural components of the Android software stack are as follows:

  • Linux kernel
  • Libraries (middleware)
  • Android Runtime
  • Application Framework
  • Applications

Which is the official programming language of Android application development?

Java is the official Android application development programming language. You can develop applications using C or C++ language. This is possible through Android Native Development.

However, Google has recently declared Kotlin as the preferred language for Android development along with Java.

What is AAPT?

AAPT stands for the ‘Android Asset Packaging Tool’. This is a part of the Android SDK. The tools allow you to handle zip compatible archives such as .zip,.jar and .apk.

Using AAPT you can develop, extract and view the contents of these archives. You can also compile resources to binary assets.

What is an activity in Android?

An activity represents the screen of an Android application. It can be considered as a window of an application.

These are used for obtaining input from a user or displaying output. An Android application may have more than one activity, meaning more than one screen.

What are the main features of Android?

Some of the key features of the Android OS are as follows:

  1. Android is platform-independent. It runs on different platforms such as Windows, Mac, and Linux.
  2. It offers multiple features such as Wi-Fi, Bluetooth, Camera, Video calling, Multi-language support, media streaming, and AI voice assistants.
  3. It is an open-source. This means it has no license, so it can be freely distributed and modified.
  4. It uses a virtual machine for mobile devices called DVM (Dalvik Virtual Machine).

Intermediate Android interview questions

Here are some intermediate Android interview questions.

What is an activity creator in Android?

An activityCreator is used for creating applications. This is the initial step before creating the application.

The activityCreator consists of a shell script which is used for creating a new file system structure where your code will exist within the Android IDE.

What are Intents in Android?

An intent is an intention for performing a task. It is a messaging object that is used for communicating between activities, services and broadcast receivers.

Intents are used for initiating a new activity in Android using startActivity() and can be used to transfer data between two or more activities.

There are two types of intents — implicit and explicit.

What are the different methods of an activity lifecycle?

The different methods involved in the life cycle of an activity are:

  • onCreate()
  • onStart()
  • onResume()
  • onPause()
  • onStop()
  • onRestart()
  • onDestroy()

Can you describe the Android framework?

Android Framework is a very important component of the Android architecture. It assists developers to create applications.

The components of the Android Framework are as follows:

  • Intent
  • Content providers
  • Activities
  • Processes, application widgets, and threads
  • Service
  • Fragment

What is a Toast in Android?

A toast in android is a mechanism through which feedback is sent to the user. This is a small notification or pop-up message that is based on user action.

This message takes just the amount of space required for displaying the message. But they are not clickable.

Toasts disappear after some time.

What are the containers?

A container is used for holding specific widgets and items together. They can hold labels, buttons, and fields.

It is a view that contains other views. There are a set of view classes that work as containers for the views. These classes are called layouts.

What are the primary components of an Android project?

The primary components of every Android project are:

  • AndroidManifest.xml
  • build.xml
  • res/
  • assets/
  • src/
  • bin/

What is a view in Android? Mention the XML syntax for creating a View.

Views are the basic building blocks of any Android UI. It is a rectangle on the user’s screen that displays some content.

It can display an image or a button to the user. It is also called a Widget that is an interactive visual.

It refers to the android.view.View class.

Here is the XML code for creating a view:

<ViewName
Attribute1=Value1
Attribute2=Value2
Attribute3=Value3
.
.
AttributeN=ValueN
/>

How will you identify view elements?

You can identify view elements by their findViewById keyword.

Briefly differentiate between an activity, file and a class in Android.

A ‘class’ is a compiled Java file with an extension of .java. This file is used for creating executable Android files with .apk extension.

A ‘file’ can be defined by any block of data or information.

An ‘activity’ is a GUI window for an application.

What is the importance of WebView in Android?

A WebView is used for displaying web pages inside the Android application. It uses the Webkit rendering engine for depicting web pages.

It has other methods for navigating through the webpages and performing searches.

For adding a WebView to your application file, you need to include the element in the XML document.

Advanced Android Interview Questions

The advanced Android developer interview questions are given below:

What do you mean by ANR in Android? Can you avoid it?

In Android, ANR stands for ‘Application Not Responding’. This is a dialogue box that appears when an application is no longer responding.

This occurs when the application does not respond when input is entered for 5 seconds or more. It might also occur when a broadcast receiver has not executed for more than 10 seconds.

Yes, ANR can be avoided. To avoid an ANR condition, a child thread can be created for the application.

You can place the primary functionalities of the application within this thread. This will help the main thread to execute with less unresponsive time.

Furthermore, the application must use extensive operations like networking operations using separate threads.

What is a 'Broadcast receiver' and how can you implement it?

A broadcast receiver handles all the communication between an Android application and the OS. It is used by the application for handling system-level events.

These can be listening for incoming calls or SMS. It also assists an application for responding to messages that are broadcasted by other applications.

You can implement a broadcast receiver as a subclass of the BroadcastReceiver.

The code to implement it is:

public class MyReceiver extends BroadcastReceiver {
Public void onReceive(context,intent){}
}

What are 'Explain services' in Android and what is the code to implement it?

A ‘service’ in Android is used for performing background tasks within an application. These tasks can be playing music, communicating with content providers and network operations.

Even if the application is destroyed, a service will run in the background. This does not have a user interface.

Explain services are of two types – local and remote.

You can implement a service using it as a subclass of the Service class.

You can use the code below:

public class MyService extends Service {
}

What are the java classes that are used along with sensors in Android?

The different Java classes that can be used along with sensors in Android are:

  1. Sensor - This class consists of the methods that are used for determining the capabilities of a sensor. You can use this for making a specific sensor instance.
  2. SensorEvent - This class provides you with raw sensor data.
  3. SensorEventListener - This java class provides the user with an interface that has to call back methods. This class receives notifications from sensor events.
  4. SensorManager - It consists of messages for calibrating sensors and can be used for creating a sensor service instance.
    It has methods for accessing sensors, registering sensor event listeners and has many sensor constants.

What are the popular use cases of an Intent?

The popular use case for using an Intent are mentioned below:

To start an activity you can pass an Intent to the startActivity() method for initiating an instance of a new activity.

To deliver a broadcast you can send a broadcast message to other applications using Intents. You can do this by passing an Intent to the methods such as sendBroadcast(), sendStickyBroadcast() or sendOrderedBroadcast().

To initiate a service you can start a service for executing operations such as downloading or uploading a file, through an Intent. This is possible by passing an Intent to the startService() method.

What is the difference between Serializable and Parcelable?

You might need to transfer data from one activity to another. For this, you have to include it in the corresponding Intent object. This object has to be parcelable and serializable.

Serializable is a Java interface that has no pre-implemented methods.

In this approach, you can mark a class serializable by implementing the interface.

Java will then serialize it. Serialisable will convert the object into a byte stream.

This way the user can transfer the data from one activity to another.

Parcelable is an Android-specific interface. You have to implement the Serialisable interface here.

The process is a bit faster than serializable. This also transforms the data into a byte stream.

The code used here is a little complex but in this approach, not many temporary objects are created.

What are some exceptions in Android?

The common exceptions in Android are:

  • InflateException - This exception is thrown when Android raises an error.

  • WindowManager.BadTokenException - This is raised when your code is trying to add a view that has an invalid LayoutParams LayoutParams#token

  • SurfaceHolder.BadSurfaceTypeException - This is an exception thrown from SurfaceHolder.lockCanvas(), when it is called on a surface that has type SURFACE_TYPE_PUSH_BUFFERS

  • Surface.OutOfResourcesException - This is encountered when the code is unable to lock a Canvas using a Surface#lockCanvas. It can also happen when a SurfaceTexture cannot be allocated properly

What is AIDL and how can you create a bounded service using it?

AIDL stands for ‘Android Interface Definition Language’. This provides you with the opportunity to define a programming interface required during IPC (Inter-Process Communication).

Both the client and the service can communicate using this interface.

The steps to create a bounded service using AIDL are:

  1. Create the .aidl file having the programming interface and the required methods.
  2. Use the abstract Stub class for extending the interface to implement it. The Stub class implements methods from your interface by extending the Binder class.
  3. By implementing the service to the clients, expose the interface. You do this by extending Service and override onBind(), for returning your implementation of Stub.

What is a nine-patch image and a .png image?

A nine-patch image can be used for a view and is stretchable. As per the contents of the view, Android will resize this type of image.

Thus, it supports multiple screen sizes. A .png image is a picture file stored using the Portable Network Graphic format.

The main difference between the two is the border. A nine-patch image has a border of 1-pixel length around the image.

This specifies where you can stretch the image for the layout. Nine patch images have an extension of .9.png.

What is DDMS?

DDMS stands for ‘Dalvik Debug Monitor Server’. It is a server for monitoring bugs that comes along with the Android SDK.

It is a debugging tool. You can include in it the Eclipse UDE by adding the ADT plug-in.
It has many features for debugging such as:

  • Spoofing location data
  • Tracking errors
  • Tracking network traffic
  • Spoofing SMS and incoming calls
  • Simulation of speed, latency, and state of the network
  • Screen capture
  • On-device thread and heap monitoring

Is it possible for two Android applications to share the same LINUX ID?

Yes, two Android applications can share the same LINUX user ID and virtual machine. For this, they have to be signed with the same certificate.

Moreover, each application has a unique user ID in Android. If this attribute has the same value for both, they can share the same LINUX ID.

Tips to ace Android developer interview questions

Know about the company

Prepare for all possible questions that can be asked. Research about the company and find relevant information to help you answer better.

Things to find may include the objective and scope of the company, its niche and growth map.

You can also visit Ambitionbox.com to get a deeper insight into workplaces.

Dress Well

Dress in formal, creaseless and comfortable clothes for your interview. Dress to impress your interviewer to leave an effective first impression.

Be Polite and Positive

Politeness and positivity can have a huge impact on your interviewer. Be polite while answering questions and maintain a positive body posture.

Suggested Reading:

Good luck!!

Tags:
Marketing
avatar-image
Misna V.K.

HR Blogger

Misna is a seasoned writer and content creator with over 7 years of experience in the field. She is the author of this continually updated career advice blog, serves as an empowering beacon for professional growth, offering readers a wealth of invaluable insights and guidance.

Member since Mar 15, 2021
BLOG

Read Our Latest News

Regularly updated blog offers career advice, from job hunting to workplace success. A valuable resource for professional growth and development.

Popular Tags
Data EntryJobsSkillsTypesWriteYourselfTipsExamplesCTCCompanyCostPrepareTechnicalInterviewLaid Off