Top 50 android Interview Questions and Answers

  1. What is Android?
What is android? Complete guide for beginners
What is Android

It is an open-sourced operating system that is used primarily on mobile devices, such as cell phones and tablets. It is a Linux kernel-based system that’s been equipped with rich components that allows developers to create and run apps that can perform both basic and advanced functions.

2. What Is the Google Android SDK?

The Google Android SDK is a toolset that developers need in order to write apps on Android enabled devices. It contains a graphical interface that emulates an Android driven handheld environment, allowing them to test and debug their codes.

3. What is the Android Architecture?

Android Architecture is made up of 4 key components:

  • Linux Kernel
  • Libraries
  • Android Framework
  • Android Applications

4. What is AAPT?

AAPT is short for Android Asset Packaging Tool. This tool provides developers with the ability to deal with zip-compatible archives, which includes creating, extracting as well as viewing its contents.

5. What is the importance of having an emulator within the Android environment?

The emulator lets developers “play” around an interface that acts as if it were an actual mobile device. They can write and test codes, and even debug. Emulators are a safe place for testing codes especially if it is in the early design phase.

6. Describe Activities?

Activities are what you refer to as the window to a user interface. Just as you create windows in order to display output or to ask for an input in the form of dialog boxes, activities play the same role, though it may not always be in the form of a user interface.

7. What is the use of an activityCreator?

An activityCreator is the first step towards the creation of a new Android project. It is made up of a shell script that will be used to create new file system structure necessary for writing codes within the Android IDE.

8. What are Intents?

Intents displays notification messages to the user from within the Android enabled device. It can be used to alert the user of a particular state that occurred. Users can be made to respond to intents.

9. What items are important in every Android project?

These are the essential items that are present each time an Android project is created:

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

10. Differentiate Activities from Services?
Activities can be closed, or terminated anytime the user wishes. On the other hand, services are designed to run behind the scenes, and can act independently. Most services run continuously, regardless of whether there are certain or no activities being executed.

11. What are containers?

Containers, as the name itself implies, holds objects and widgets together, depending on which specific items are needed and in what particular arrangement that is wanted. Containers may hold labels, fields, buttons, or even child containers, as examples.

12. What is the importance of XML-based layouts?

The use of XML-based layouts provides a consistent and somewhat standard means of setting GUI definition format. In common practice, layout details are placed in XML files while other items are placed in source files.

13. What is Orientation?

Orientation, which can be set using setOrientation(), dictates if the LinearLayout is represented as a row or as a column. Values are set as either HORIZONTAL or VERTICAL.

14. What do you think are some disadvantages of Android?

Given that Android is an open-source platform, and the fact that different Android operating systems have been released on different mobile devices, there’s no clear cut policy to how applications can adapt with various OS versions and upgrades. One app that runs on this particular version of Android OS may or may not run on another version. Another disadvantage is that since mobile devices such as phones and tabs come in different sizes and forms, it poses a challenge for developers to create apps that can adjust correctly to the right screen size and other varying features and specs.

15. What is the importance of Android in the mobile market?

Developers can write and register apps that will specifically run under the Android environment. This means that every mobile device that is Android enabled will be able to support and run these apps. With the growing popularity of Android mobile devices, developers can take advantage of this trend by creating and uploading their apps on the Android Market for distribution to anyone who wants to download it.

16. What is adb?

Adb is short for Android Debug Bridge. It allows developers the power to execute remote shell commands. Its basic function is to allow and control communication towards and from the emulator port.

17. What are the four essential states of an activity?

  • Active – if the activity is at the foreground
  • Paused – if the activity is at the background and still visible
  • Stopped – if the activity is not visible and therefore is hidden or obscured by another activity
  • Destroyed – when the activity process is killed or completed terminated.

18. What is ANR?

ANR is short for Application Not Responding. This is actually a dialog that appears to the user whenever an application have been unresponsive for a long period of time.

19. Which elements can occur only once and must be present?

Among the different elements, the “and” elements must be present and can occur only once. The rest are optional, which can occur as many times as needed.

20. How are escape characters used as attribute?

Escape characters are preceded by double backslashes. For example, a newline character is created using ‘\n’

21. What is the function of an intent filter?

Because every component needs to indicate which intents they can respond to, intent filters are used to filter out intents that these components are willing to receive. One or more intent filters are possible, depending on the services and activities that is going to make use of it.

22. What is the importance of settings permissions in app development?

Permissions allow certain restrictions to be imposed primarily to protect data and code. Without these, codes could be compromised, resulting to defects in functionality.

23. Enumerate the three key loops when monitoring an activity?

  • Entire lifetime – activity happens between onCreate and onDestroy
  • Visible lifetime – activity happens between onStart and onStop
  • Foreground lifetime – activity happens between onResume and onPause

24. Enumerate the three key loops when monitoring an activity?

  • Entire lifetime – activity happens between onCreate and onDestroy
  • Visible lifetime – activity happens between onStart and onStop
  • Foreground lifetime – activity happens between onResume and onPause

25. Is there a case wherein other qualifiers in multiple resources take precedence over locale?

Yes, there are actually instances wherein some qualifiers can take precedence over locale. There are two known exceptions, which are the MCC (mobile country code) and MNC (mobile network code) qualifiers.

26. What are the different states wherein a process is based?

There are 4 possible states:

  • foreground activity
  • visible activity
  • background activity
  • empty process

27. What role does Dalvik play in Android development?

Dalvik serves as a virtual machine, and it is where every Android application runs. Through Dalvik, a device is able to execute multiple virtual machines efficiently through better memory management.

28. How can the ANR be prevented?

One technique that prevents the Android system from concluding a code that has been responsive for a long period of time is to create a child thread. Within the child thread, most of the actual workings of the codes can be placed, so that the main thread runs with minimal periods of unresponsive times.

29. What is the AndroidManifest.xml?

This file is essential in every application. It is declared in the root directory and contains information about the application that the Android system must know before the codes can be executed.

30. What is the proper way of setting up an Android-powered device for app development?

The following are steps to be followed prior to actual application development in an Android-powered device:

  • -Declare your application as “debuggable” in your Android Manifest.
  • -Turn on “USB Debugging” on your device.
  • -Set up your system to detect your device.

31. List the languages used to build Android?

The most popular programming languages that can be used to develop applications in Android are:

  • Java: It has always been a starting point for new developers and used by the majority of people who work with Android development. Eclipse, NetBeans, and IntelliJ IDE are the most popular IDE’s(Integrated Development Environment) used for developing an Android application using java.
  • Kotlin: Kotlin is a relatively new, modern, safe, and object-oriented cross-platform programming language used in developing an Android application. IDE’s used with kotlin are Android studio, Eclipse IDE, etc.
  • C#: Developers can build native iOS and Android mobile applications by using the C# language. Visual Studio is the best tool for developing an Android application using C#.
  • Python: It is a dynamic and object-oriented programming language. It is very popular in machine learning. Pydroid 3, Dcoder, spck code editor is some of the code editors for Python.
  • Other languages which can be used in Android development are C++, HTML 5. C4droid, CppDroid, AIDE, etc. are IDE’s for C++. Acode, spck code editor, etc. are examples of IDE’s used with HTML.

32. What is a service in Android?

Services in Android

Service is an application component that facilitates an application to run in the background in order to perform long-running operations without user interaction. A service can run continuously in the background even if the application is closed or even after the user switches to another application.

33. What is the use of Bundle in Android?

Bundles are used to pass the required data between various Android activities. These are like HashMap that can take trivial data types. Below code shows how to transfer a piece of data by using bundle:


Bundle b=new Bundle();
i.putExtras(b); // where i is intent

34. What is portable Wi-Fi hotspot?

Portable Wi-Fi Hotspot permits you to share your mobile internet connection with other wireless devices. For example, using your Android phone as a Wi-Fi hotspot, you can use your laptop to connect to the internet using that access point.

35. What is Android Debug Bridge(ADB)?

Android Debug Bridge is a command-line tool used to allow and control communication with an emulator instance. It gives the power for developers to execute remote shell commands to run applications on an emulator.

36. What is DDMS?

DDMS(Dalvik Debug Monitor Server) is a debugging tool in the Android platform. It gives the following list of debugging features:

  • Port forwarding services.
  • Thread and heap information.
  • Logcat.
  • Screen capture on the device.
  • Network traffic tracking.
  • Incoming call and SMS spoofing.
  • Location data spoofing

37. What is the life cycle of Android activity?

life cycle of Android activity
  • OnCreate(): It is called when activity is created. Using this, the views are created and data is collected from bundles.
  • OnStart(): It is called if the activity is becoming visible to the user. It may be succeeded by onResume() if the activity comes to the foreground, or onStop() if it becomes hidden.
  • OnResume(): It is called when the activity will start an interaction with the user.
  • OnPause(): This is called when the activity is moving to the background but hasn’t been killed yet.
  • OnStop(): This is called when an activity is no longer visible to the user.
  • OnDestroy(): This is called when the activity is finished or destroyed.
  • OnRestart(): This is called after the activity has been stopped, prior to it being started again.

38. Explain Sensors in Android?

Android-based devices have a collection of built-in sensors in them, which measure certain parameters like motion, orientation, and many more through their high accuracy. The sensors can be both hardware and software based on nature. There are three prominent categories of sensors in Android devices. They are:

  • Position Sensor: It is used for measuring the physical position of the Android device. This has orientation sensors and magnetometers.
  • Motion Sensors: These sensors consist of gravity, rotational activity, and acceleration sensors which measure the rotation of the device or the acceleration, etc.
  • Environmental Sensor: It includes sensors that measure temperature, humidity, pressure, and other environmental factors.

39. What is AndroidManifest.xml file and why do you need this?

  • The AndroidManifest.xml file contains information regarding the application that the Android system must know before the codes can be executed.
  • This file is essential in every Android application.
  • It is declared in the root directory.
  • This file performs several tasks such as:
  • Providing a unique name to the java package.
  • Describing various components of the application such as activity, services, and many more.
  • Defining the classes which will implement these components.

40. Explain the dialog boxes supported on Android?

Android supports four dialog boxes. They are:


  • The AlertDialog supports 0-3 buttons, along with a list of selectable items such as checkboxes and radio buttons.
  • It is used when you want to ask the user about taking a decision between yes or no in response to any particular action taken by the user, by remaining in the same activity and without changing the screen.


It is used for selecting the date by the user.


Used for selecting the time by the user.


  • It is an extension of the AlertDialog and is used to display a progress bar. It also supports the addition of buttons.
  • This class was deprecated in API level 26 because it prevents the user from interacting with the application. Instead of this class, we can use a progress indicator such as ProgressBar, which can be embedded in the user interface of your application.

41. Mention the difference between class, file and activity in Android?

The difference between them is as follows:

  • Class is a compiled form of a .java file that Android uses to produce an executable .apk file.
  • A file is a block of arbitrary information or resources used for storing information. It can be of any file type.
  • Activity is a single screen that represents GUI(Graphical User Interface) with which users can interact in order to do something like dial the phone, view email, etc.

42. What is context?

The context in Android is the context of the current state of the application or object. The context comes with services like giving access to databases and preferences, resolving resources, and more.

There are two types of context. They are:

Activity context

  • This activity context is attached to the lifecycle of an activity.
  • The activity context can be used when you are passing the context in the scope of an activity or you need the context whose lifecycle is attached to the context of the activity.

Application context:

  • This application context is attached to the lifecycle of an application.
  • The application context should be used where you need a context whose lifecycle is separate from the current context or when you are passing a context beyond the scope of activity.

43. What is a Toast? Write its syntax?

Toast is a message that pops up on the screen. It is used to display the message regarding the status of the operation initiated by the user and covers only the expanse of space required for the message while the user’s recent activity remains visible and interactive.

Toast notification automatically fades in and out and it does not accept interaction events.



Toast.makeText(ProjectActivity.this, "Your message here", Toast.LENGTH_LONG).show();

44. Explain the difference between Implicit and Explicit Intent?

The difference between the implicit and explicit Intents are given below:

Explicit Intent:

An Explicit Intent is where you inform the system about which activity should handle this intent. Here target component is defined directly in the intent.

For example,


Intent i = new Intent(this, Activitytwo.class); #ActivityTwo is the target component
i.putExtra("Value1","This is ActivityTwo"); 
i.putExtra("Value2","This Value two for ActivityTwo"); 

Implicit Intent:

An Implicit Intent permits you to declare the action you want to carry out. Further, the Android system will check which components are registered to handle that specific action based on intent data. Here target component is not defined in the intent.

For example,


Intent i = new Intent(ACTION_VIEW,Uri.parse("http://www.interview")); 

45. What are the troubleshooting techniques you can follow if an application is crashing frequently?

If an Android application is crashing frequently, you can follow the below-given techniques:

Compatibility Check:

It is not possible to test an application for all kinds of devices and operating systems. There might be a possibility that an application is not compatible with your OS.

Memory Management:

  • Some apps run perfectly on one mobile device but might crash on other devices. This is where processing power, memory management, and CPU speed are considered.
  • As there is a limited amount of memory space on mobile devices, you can free up memory space for the application to function properly.
  • If an application is frequently crashing, you can delete the application’s data, which will clear its cache memory and allow some free space on your device and might boost the app’s performance.

46. Explain different launch modes in Android?

Understanding android Activity and Its Launch Modes Standard, singleTop,  singleTask, and singleInstance (with examples) - IT-INSIDE - Learn Coding!
Different launch modes in android

The different launch modes in Android are given below:


  • This launch mode generates an activity’s new instance in the task from which it originated.
  • It is possible to create several instances for the same activity.
  • For Example, suppose our current stack is A -> B -> C. Now, if we launch activity B again with the “standard” launch mode, then the new stack will be A -> B -> C -> B.


  • This launch mode is similar to the Standard launch mode except if there exists an activity’s previous instance on the top of the stack, then a new instance will not be created.
  • But the intent will be sent to the activity’s existing instance.
  • For example, suppose our current stack is A -> B -> C. Now, if we launch the activity B again with “singleTop” launch mode,then the new stack will be A -> B -> C -> B.
  • Consider another example, where the current stack is A -> B -> C. Now, if we launch activity C again with the “singleTop” launch mode, then the stack will remain the same i.e., A -> B -> C. The intent will be passed to the onNewIntent() method.


  • This launch mode will create a new task and push a new instance to the task as the root.
  • For example, suppose our current stack is A -> B -> C -> D. Now, if we launch activity B again with the “singleTask” launch mode, then the new stack will be A -> B. Here, a callback has been received on the old instance and C and D activities are destroyed.


This launch mode is similar to the SingleTask launch mode. But the system doesn’t support launching any new activities in the same task.
In a situation where the new activity is launched, it is launched in a separate task.
For example, Suppose our current stack is A -> B -> C. Now, if we launch the activity D with the “singleInstance” launch mode, then there will be two stacks:

  • A -> B -> C
  • D, If you call activity E, then it will be added to the first stack.
  • A -> B -> C -> E
  • D

Again if you Call the activity D, then it will call the same activity from the 2nd stack and pass the intent to onNewIntent().

47. What are broadcast receivers? How is it implemented?

A broadcast receiver is a mechanism used for listening to system-level events like listening for incoming calls, SMS, etc. by the host application. It is implemented as a subclass of BroadcastReceiver class and each message is broadcasted as an intent object.


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

48. What is the difference between Serializable and Parcelable? Which is the best approach in Android?

Parceable serializable
difference between Serializable and Parcelable

While developing applications usually it needs to transfer data from one activity to another. This data needs to be added into a corresponding intent object. Some additional actions are required to make the data suitable for transfer. For doing that the object should be either serializable or parcelable.


  • Serializable is a standard Java interface. In this approach, you simply mark a class Serializable by implementing the interface and java will automatically serialize it.
  • Reflection is used during the process and many additional objects are created. This leads to plenty of garbage collection and poor performance.


  • Parcelable is an Android-specific interface. In this approach, you implement the serialization yourself.
  • Reflection is not used during this process and hence no garbage is created.
  • Parcelable is far more efficient than Serializable since it gets around some problems with the default Java serialization scheme. Also, it is faster because it is optimized for usage on the development of Android, and shows better results.

49. What are the differences between Service and Thread?

The main difference between Service and Thread is given below:

Service is an application component that facilitates an application to run in the background in order to perform long-running operations without user interaction.A Thread is a concurrent unit of execution.
It exposes few functionalities to other applications by calling Context.bindService().Google has brought in handlers and loopers into threads.
When an application is killed, service is not killed.When an application is killed, the thread is killed.

50. What is the significance of the .dex file?

Android programs are compiled into a .dex file (Dalvik Executable file) by DVM, which are then zipped into a .apk file on the device. .dex files are created by translating compiled applications written in java. .dex is a format that is optimized for effective storage and memory-mappable executions.

Rajesh Kumar
Follow me
Notify of
Inline Feedbacks
View all comments
Would love your thoughts, please comment.x