Android Interview Questions And Answers

TOP 100 Android Interview Questions And Answers

Frequently Asked Android Interview Questions And Answers

Android Interview Questions And Answers are as follows-

1) 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) Describe the Android Framework.

The Android Framework is an important aspect of the Android Architecture. Here you can find all the classes and methods that developers would need in order to write applications on the Android environment.

5) 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.

6) 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.

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 ) 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.

9) 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.

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 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/

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 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.

14) 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.

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 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.

17) 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.

18) 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

19) 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.

20) 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, and can occur as many times as needed.

21) How are escape characters used as attribute?

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

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) 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.

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) When is the onStop() method invoked?

A call to onStop method happens when an activity is no longer visible to the user, either because another activity has taken over or if in front of that activity.

26) 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.

27) What are the different states wherein a process is based?

There are 4 possible states:

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

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 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.

30) 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.

31) 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.

32) Enumerate the steps in creating a bounded service through AIDL.

  1. create the .aidl file, which defines the programming interface
    2. implement the interface, which involves extending the inner abstract Stub class as well as implanting its methods.
    3. expose the interface, which involves implementing the service to the clients.

33) What is the importance of Default Resources?

When default resources, which contain default strings and files, are not present, an error will occur and the app will not run. Resources are placed in specially named subdirectories under the project res/ directory.

34) When dealing with multiple resources, which one takes precedence?

Assuming that all of these multiple resources are able to match the configuration of a device, the ‘locale’ qualifier almost always takes the highest precedence over the others.

35) When does ANR occur?

The ANR dialog is displayed to the user based on two possible conditions. One is when there is no response to an input event within 5 seconds, and the other is when a broadcast receiver is not done executing within 10 seconds.

36) What is AIDL?

AIDL, or Android Interface Definition Language, handles the interface requirements between a client and a service so both can communicate at the same level through interprocess communication or IPC. This process involves breaking down objects into primitives that Android can understand. This part is required simply because a process cannot access the memory of the other process.

37) What data types are supported by AIDL?

AIDL has support for the following data types:

-all native Java data types like int,long, char and Boolean

38) What is a Fragment?

A fragment is a part or portion of an activity. It is modular in a sense that you can move around or combine with other fragments in a single activity. Fragments are also reusable.

39) What is a visible activity?

A visible activity is one that sits behind a foreground dialog. It is actually visible to the user, but not necessarily being in the foreground itself.

40) When is the best time to kill a foreground activity?

The foreground activity, being the most important among the other states, is only killed or terminated as a last resort, especially if it is already consuming too much memory. When a memory paging state has been reach by a foreground activity, then it is killed so that the user interface can retain its responsiveness to the user.

41) Is it possible to use or add a fragment without using a user interface?

Yes, it is possible to do that, such as when you want to create a background behavior for a particular activity. You can do this by using add(Fragment,string) method to add a fragment from the activity.

42) How do you remove icons and widgets from the main screen of the Android device?

To remove an icon or shortcut, press and hold that icon. You then drag it downwards to the lower part of the screen where a remove button appears.

43) What are the core components under the Android application architecture?

There are 5 key components under the Android application architecture:

– services
– intent
– resource externalization
– notifications
– content providers

44) What composes a typical Android application project?

A project under Android development, upon compilation, becomes an .apk file. This apk file format is actually made up of the AndroidManifest.xml file, application code, resource files, and other related files.

45) What is a Sticky Intent?

A Sticky Intent is a broadcast from sendStickyBroadcast() method such that the intent floats around even after the broadcast, allowing others to collect data from it.

46) Do all mobile phones support the latest Android operating system?

Some Android-powered phone allows you to upgrade to the higher Android operating system version. However, not all upgrades would allow you to get the latest version. It depends largely on the capability and specs of the phone, whether it can support the newer features available under the latest Android version.

47) What is portable wi-fi hotspot?

Portable Wi-Fi Hotspot allows you to share your mobile internet connection to other wireless device. For example, using your Android-powered phone as a Wi-Fi Hotspot, you can use your laptop to connect to the Internet using that access point.

48) What is an action?

In Android development, an action is what the intent sender wants to do or expected to get as a response. Most application functionality is based on the intended action.

49) What is the difference between a regular bitmap and a nine-patch image?

In general, a Nine-patch image allows resizing that can be used as background or other image size requirements for the target device. The Nine-patch refers to the way you can resize the image: 4 corners that are unscaled, 4 edges that are scaled in 1 axis, and the middle one that can be scaled into both axes.

50) What language is supported by Android for application development?

The main language supported is Java programming language. Java is the most popular language for app development, which makes it ideal even for new Android developers to quickly learn to create and deploy applications in the Android environment.

51) What is the latest version of Android? List all the versions of Android.

The latest version is Android 9.0- Android Pie released in August, 2018. Android is a mobile operating system developed by Google. It is based on the Linux kernel and designed primarily for touchscreen mobile devices such as smartphones and tablets. Every other Android version has been named after either sweet or desserts. The following table represents the Android name, version and the year of release.

Android Name Version Year of Release
Android 1.5 Android Cupcake 2009
1.6 Donut 2009
2.0-2.1 Eclair 2009
2.2 – 2.2.3 Froyo 2010
2.3 – 2.3.7 Gingerbread 2010
3.0 – 3.2.6 Honeycomb 2011
4.0 – 4.0.4 Ice Cream Sandwich 2011
4.1 – 4.3.1 Jelly Bean 2012
4.4 – 4.4.4 KitKat 2013
5.0 – 5.1.1 Lollipop 2014
6.0 – 6.0.1 Marshmallow 2015
7.0 – 7.1.2 Nougat 2016
8.0 – 8.1 Oreo 2017
9.0 Pie 2018


  1. What is an Activity? Which method is implemented by all subclasses of an Activity? 

An Activity is the screen representation of an application in Android.

It serves as an entry point for the user’s interaction. Each activity has a layout file where you can place your UI. An application can have different activities. For example, facebook start page where you enter your email/phone and password to login acts as an activity.

Below are the two methods which almost all subclasses of Activity will implement:

onCreate(Bundle): It is a method where your initialization is done. Under this, you will callsetContentView(int) with a layout resource which defines your UI.  Also, you can retrieve the widgets in that UI by using findViewById(Int).  These are required to interact programmatically.

onPause(): It is a method which deals with the user whenever it leaves the activity. So any changes made by the user should be commited which is done by the ContentProvider that holds the data.

An activity is implemented as a subclass of Activity class as follows:

public class MainActivity extends Activity {


  1. What are the features of Android?

Google has changed the lives of everyone by launching a product that improves the mobile experience for everyone. Android helps in understanding your tastes and needs, by giving various features such as having wallpapers, themes, and launchers which completely change the look of your device’s interface.

Android has plenty of features. Some of the features are listed below:


Customizable operating System

Variety of apps can be developed.

Reduces overall complexity

Supports messaging services, web browser, storage(SQLite), connectivity,media and many more.

  1. Which programming language is used for Android App development?

Java is the official programming language for Android App development. It is also possible to develop in C/ c++ language using  NDK (Android Native Development). However, the major parts of Android are written in Java programming language and the APIs are also designed primarily from Java.

  1. What is APK format?

The APK file or Android application package is the compressed file format that is used to distribute and install application software and middleware onto Google’s Android operating system. The file has .apk extension and has all the application code, resource files, certificates, and other files, compressed in it.

  1. What is the life cycle of android activity?

User navigates between different screen or app, it goes through different states in their lifecycle. So an activity lifecycle consists of 7 different methods of class i.e :

onCreate() : In this state, the activity is created.

onStart(): This callback method is called when the activity becomes visible to the user.

onResume(): The activity is in the foreground and the user can interact with it.

onPause(): Activity is partially obscured by another activity. Other activity that’s in the foreground is semi-transparent.

onStop(): The activity is completely hidden and not visible to the user.

onDestroy(): Activity is destroyed and removed from the memory.


  1. Define intents in Android. What are the different types of intents?

An Intent is an “intention” to do an action.  An intent is a messaging object you can use to request an action from another app component.

Methods are used to deliver intents to different components:

context.startActivity() – To start an activity

context.startService() – To start a service

context.sendBroadcast() – To deliver a broadcast

Types of Intent:

Implicit Intent: Implicit intent is when the target component is not defined in the intent and the android system has to evaluate the registered components based on the intent data.

Explicit Intent: Explicit intent is when an application defines the target component directly in the intent.

  1. What is the difference between an implicit intent and explicit intent?

Implicit Intent is used whenever you are performing an action. For example, send email, SMS, dial number or you can use a Uri to specify the data type. For example:

Intent i = new Intent(ACTION_VIEW,Uri.parse(“<a href=””></a>”));


Explicit, on the other hand, helps you to switch from one activity to another activity(often known as the target activity). It is also used to pass data using putExtra method and retrieved by other activity by getIntent().getExtras() methods.

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”);


59) What is the difference between File, Class, and Activity in android?

The difference between them are as follows:

File is a block of arbitrary information or resources for storing information. It can be any file type.

Class is a compiled from of .Java file which Android uses to produce an executable apk.

Activity is the equivalent of a Frame/Window in GUI toolkits. It is not a file or a file type but just a class that can be extended in Android to load UI elements on view.

60) What is Google Android SDK? What are the tools placed in android SDK?

The Google Android SDK is a toolset that provides a developer the API libraries and tools required to build, test, and debug apps for Android in Windows, Mac or Linux. The tools placed in Android SDk are:

Android Emulator

DDMS – Dalvik Debug Monitoring Services

AAPT – Android Asset Packaging tool

ADB – Android debug bridge

61) What is a Toast? Write its syntax.

Toast notification is a message that pops up on the window.

It only covers the expanse of space required for the message and the user’s recent activity remains visible and interactive.

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


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

62) What is an ANR? What are some measures you can take to avoid ANR?

ANR stands for ‘Application Not Responding’. This dialogue is displayed if the main thread in the application has been unresponsive for a long time and in the following conditions:

When there is no response to an input event after 5 seconds.

When a broadcast receiver is not done executing within 10 seconds.

Following measures can be taken to avoid ANR:

To avoid ANR, an app should perform a lengthy database or networking operations in separate threads.

One technique is to create a child thread to prevent the Android system from concluding a code that has been unresponsive for a long period of time. Most of the actual workings of the codes can be placed within the child thread to ensure that the main thread runs with minimal unresponsive time.

For background task-intensive apps, you can alleviate pressure from the UI thread by using the IntentService.

63) What are broadcast receivers? How is it implemented?

Broadcast Receiver is a mechanism using which host application can listen for System level events.

Broadcast receiver is used by the application whenever they need to perform the execution based on system events. Like listening for Incoming call, sms etc.

Broadcast receivers helps in responding to broadcast messages from other application or from the system.

It is used to handle communication between Android operating system and applications.

It is implemented as a subclass of BroadcastReceiver class and each message is broadcaster as an Intent object.

public class MyReceiver extends BroadcastReceiver {

Public void onReceive(context,intent){}


64) How will you pass data to sub-activities?

We can use Bundles to pass data to sub-activities.

There are like HashMaps that and take trivial data types. These Bundles transport information from one Activity to another

Bundle b=new Bundle();


i.putExtras(b); // where I is intent

65) What is the use of WebView in Android?

WebView is a view that display web pages inside your application. According to Android, “this class is the basis upon which you can roll your own web browser or simply display some online content within your Activity. It uses the WebKit rendering engine to display web pages and includes methods to navigate forward and backward through a history, zoom in and out, perform text searches and more. In order to add WebView to your application, you have to add <WebView>element to your XML layout file.

66) What are the different kinds of context in Android?

Context defines the current state of an App. Context provides access to creating new activity instance, access databases, start a service, etc. There is a base class ApplicationContext, and subclasses for components: Activity, Service.

67) Explain in brief about the important file and folder when you create a new app?

App – It describes the fundamental characteristics of the app and defines each of its components.

java – This contains the .java source files for your project. By default, it includes an source file. Under this, you create all the activities which have .java extensions and all the code behind the application. is the actual file which gets converted to a dalvik executable and runs your app.

res – It is a directory for files that define your app’s user interface. You can add TextView, button etc to build the GUI and use its various attributes like android:layout_widthandroid:layout_height etc which are used to set its width and height.

Gradle Scripts – This is an auto-generated file which contains compileSdkVersion, buildToolsVersion, applicationId, minSdkVersion, targetSdkVersion, versionCode and versionName

68) What are the different storage methods in Android?

Android offers several options to see persistent application data. They are:

Shared Preferences – Store private primitive data in key-value pairs

Internal Storage – Store private data on the device memory

External Storage – Store public data on the shared external storage

SQLite Databases – Store structured data in a private database

69) What is a Service? How is it implemented?

A service in android is a background process which is used to perform long-running operations. Let’s say, a service of location is active in the background while the user is in a different application. So it does not disturb the user interaction with an activity. Now, services are classified into two types, namely:

Local: This service is accessed from within the application.

Remote – This service is accessed remotely from other applications running on the same device.

It is implemented as a subclass of Service class as follows :

public class MyService extends Service {


70) What is a Sticky Intent?

A Sticky Intent is a broadcast from sendStickyBroadcast() method which floats around even after the broadcast, allowing others to collect data from it.

71) Explain Folder, File & Description of Android Apps

src: contains the .java source files for your project.

gen: contains the .R file, a compiler-generated file that references all the resources found in your project.

bin: contains the Android package files .apk built by the ADT during the build process and everything else needed to run an Android application.

res/drawable-hdpi: this is a directory for drawable objects that are designed for high-density screens.

res/layout: this is a directory for files that define your app’s user interface.

res/values: this is a directory for other various XML files that contain a collection of resources, such as strings and colors definitions.

AndroidManifest.xml: this is the manifest file which describes the fundamental characteristics of the app and defines each of its components.

72) How does Manifest file plays an integral role in App development?

Manifest file plays an integral role as it provides the essential information about your app to the Android system, which the system must have before it can run any of the app’s code. Manifest file performs various tasks such as:

It names the Java package for the app as the package name serves as a unique identifier for the application.

It protects the application by declaring permissions in order to access protected parts of the API and interact with other applications.

Manifest file declares the minimum level of the android API and list the libraries which is linked with the application.

Manifest file list the instrumentation classes.  These classes provide profiling and other information as the application runs, but this information is removed as soon the application is publishes. It remains only till the application is in development mode.

Structure of a manifest file: The structure of a manifest file consists of various elements such as action, activity, activity-alias and many more.

73) What is the difference between a fragment and an activity?

Activity is typically a single, focused operation that a user can perform such as dial a number, take a picture, send an email, view a map etc.

Fragment is a modular section of an activity, with its own lifecycle and input events, and which can be added or removed at will. Also, a fragment’s lifecycle is directly affected by its host activity’s lifecycle i.e. when the activity is paused, so are all fragments in it, and when the activity is destroyed, so are all of its fragments.

74) What database is used in Android? How does it differ from client-server database management systems?

SQLite is the open-source relational database. The SQLite engine is serverless, transactional, and self-contained.
Instead of the typical client-server relationship of most database management systems, the SQLite engine is integrally linked with the application. The library can also be called dynamically and makes use of simple function calls that reduce latency in database access.

75) What is DDMS?

DDMS stands for Dalvik Debug Monitor Server. It gives the following array of debugging features:

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

76) What is the difference between Service and Thread?

Service Thread
 Service is like an Activity but has no interface.  A Thread is a concurrent unit of execution.
A Service is not a separate process. It works in background until the service or someone else explicitly stop it. By default, all components of the same application run in the same process and thread (called the “main” thread).
Service is not killed when an application is killed.  Thread is killed when an Application is killed.
It expose some of its functionality to other applications by calling Context.bindService(). GOOGLE has brought in Handlers and loopers into android threads.


77) What are the containers?

Containers, 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.

78) What is an Android Runtime?

Android Runtime consists of Dalvik Virtual machine and Core Java libraries.

DVM is optimized for low processing power and low memory environments.

Unlike JVM, the Dalvik Virtual Machine doesn’t run .class files, instead it runs .dex files.

Android 2.2 “Froyo“ brought trace-based just-in-time (JIT) compilation into Dalvik, optimizing the execution of applications and dynamically compiling frequently executed short segments of their bytecode into native machine code.

79) What is the importance of an emulator in Android?

The emulator lets you play around an interface that acts as if it were an actual device.

It let you write and test codes, and even debug.

It acts as a safe place for testing codes especially if its in the early design phase.

80). Name the four essential states of an activity.

The four essential states of activity are:

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

81) What is the difference between a regular bitmap and a nine-patch image?

A nine-patch image, unlike bitmap, can be resized and used as background or other image sizes for the target device. The Nine-patch refers to the way you can resize the image: 4 corners that are unscaled, 4 edges that are scaled in 1 axis, and the middle one that can be scaled into both axes. This is what differentiates a nine-patch image from a regular bitmap.

82) What are the core building blocks of android?

Activity : An Activity is the screen representation of any application in Android.  Each activity has a layout file where you can place your UI.

Content Provider: Content providers share data between applications.

Service: It is a component that runs in the background to perform long-running operations without interacting with the user and it even works if application is destroyed.

Broadcast Receivers: It respond to broadcast messages from other applications or from the system itself. These messages are sometime called events or intents.

83) What are the dialog boxes that are supported in Android?

Android supports four dialog boxes:

AlertDialog: An alert dialog box supports zero to three buttons and a list of selectable elements, including checkboxes and radio buttons. Among the other dialog boxes, the most suggested dialog box is the alert dialog box.

ProgressDialog: This dialog box displays a progress wheel or a progress bar. It is an extension of AlertDialog and supports adding buttons.

DatePickerDialog: This dialog box is used for selecting a date by the user.

TimePickerDialog: This dialog box is used for selecting time by the user.

84) What is a sticky broadcast? Give an example.

A sticky broadcast is used for communicating between applications. These broadcasts happen without the user being notified. The Android OS normally treats each application as if it were a separate user. Here’s an example: When you call registerReceiver() for that action — even with a null BroadcastReceiver — you get the Intent that was last broadcast for that action. Hence, you can use this to find the state of the battery without necessarily registering for all future state changes in the battery.

85) What is Dalvik Virtual Machine (DVM)?

Dalvik is the name of Android’s virtual machine.

The Dalvik VM is an interpreter-only virtual machine that executes files in the Dalvik Executable (.dex) format.

The virtual machine is register-based and can run classes compiled by Java language compiler that have been altered into its native format using the included ‘dx’ tool.

The Dalvik core class library is envisioned to provide a familiar development base for those used to programming with Java Standard Edition, but is geared explicitly for the needs of a small mobile device.

86) What are the exceptions in android?

InflateException: When error conditions occur this exception is thrown.

Surface.OutOfResourceException: When a Surface is not created or resized, this exception is thrown.

SurfaceHolder.BadSurfaceTypeException: When invoked on a Surface ‘SURFACE_TYPE_PUSH_BUFFERS’, this exception is thrown from lockCanvas() method.

WindowManager.BadTokenException: This exception is thrown at the time of trying to view an invalid WindowManager.LayoutParamstoken

87) What is a content provider? How is it implemented?

Content providers manage access to a structured set of data. It is the standard interface that connects data in one process with code running in another process.

They encapsulate the data and provide mechanisms for defining data security.

Content providers are used to share the data between different applications.

It is implemented as a subclass of ContentProviderclass and must implement a standard set of APIs that enable other applications to perform transactions.

public class MyContentprovider extends ContentProvider {

public void onCreate(){}


88) What is the significance of the .dex files?

Android programs are compiled into ‘.dex’ (Dalvik Executable) files, which are zipped into a single .apk file on the device.

‘.dex’ files can be created by translating compiled applications written in Java.

(.dex) is a format that is optimized for effective storage and memory-mappable executions.

89) How are escape characters used as attribute?

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

90) What does ADB stand for?

ADB stands for Android Debug Bridge. It is a command line tool that is used to communicate with the emulator instance. ADB can control your device over USB from a computer, copy files back and forth, install and uninstall apps, run shell commands, and more.

It is a client-server program that includes three components:
• Client – which runs on your development machine. You can invoke a client from a shell by issuing an ADB command. Other Android tools such as DDMS also create ADB clients.
• Server, which runs as a background process on your development machine. The server manages communication between the client and the ADB daemon running on an emulator or device.
• Daemon, which runs as a background process on each emulator or device instance.

91) Can you list and explain the four Java classes related to using sensors on the Android platform?

Sensor Manager: This class provides methods regarding the registration of sensor event listeners, the management of data acquisition, and calibration. It also provides methods for accessing and listing sensors.

Sensor: This class creates an instance of a specific sensor, providing methods that allow you to determine its capabilities.

SensorEvent: This class provides information on a sensor event by creating a sensor event object.

SensorEventListener: This interface provides two callback methods that can receive notifications of sensor events.

92) What is AIDL? What are the datatypes supported by AIDL ?

AIDL stands for Android Interface Definition Language.
– It handles the interface requirements between a client and a service to communicate at the same level through interprocess communication.
– The process involves breaking down objects into primitives that are Android understandable.

Data Types:





Native Java data types (int, long, char and Boolean)

93) Explain the build process in Android?

Answer: The build process in Android involves three steps

The first step consists of the compilation of the resources folder using the Android Asset Packaging Tool (AAPT). These are compiled into a single class file known as, which only holds constants.

In the second step, the java source code needs to be compiled to .class files using javac, which are then converted to Dalvik bytecode using the ‘dx’ tool, which is one of the tools in the software development kit. The final output file is classes.ex.

In the third and final step, the Android apkbuilder is required to take all the inputs and build the Android Packaging Key (APK) file.

94) List some languages that can be used to program in Android

Answer: Below is a list of the most popular programming languages that can be used to develop applications in Android

Java: Java, the most popular programming language in the world has always been a starting point for new developers and used by the majority of people who work with Android development.

Kotlin: Kotlin is a relatively new, modern, safe and object-oriented cross-platform programming language. When Android studio 3.0 was released in Oct 2017, Kotlin was announced as the official programming language for Android. Many popular applications such as Trello, Square and Corda have since then shifted to Kotlin.

C#: Using the C# language developers can build native iOS and Android mobile applications.

Python: Python has emerged as one of the most popular programming languages in recent times. A dynamic and object-oriented programming language, Python is very popular in machine learning.

Other languages that can be used in Android are C++, HTML 5.

95) What are the different tools available in Android development? Explain their functions.

Answer: There are a variety of tools available to help Android developers:

Android Software Development Kit (SDK) and Virtual Device Manager: This tool is used to generate and handle Android Virtual Devices (AVD) and SDKs. Through the emulator in the AVD, you can specify the supported SDK version, storage in the SD card, screen resolution, and other abilities such as GPS and touch screen.

The Android Emulator: The AE is the implementation of the Android Virtual Machine, designed to run processes within a virtual device itself, which can be used on a development computer. The main use of this tool is in testing and debugging of Android applications.

Android Debug Bridge (ADB): The ADB is a command-line debugging application doled out with the SDK. It enables developers to communicate with the device, and facilitates actions such as the installation and debugging of an application.

Android Asset Packaging Tool (AAPT): The AAPT builds the ‘.apk’ distributable Android package file.

96) What is Android Runtime?

Answer: Android Runtime (ART) is an application used by the Android OS as a runtime environment. It has now replaced Dalvik, a discontinued process Virtual Machine (VM). ART translates the bytecode of the application into native instructions, which are carried out by the device’s runtime environment.

97) Explain the dialog boxes supported on Android.

Answer: Android supports four dialog boxes

AlertDialog: The most suggested dialog box, the AlertDialog supports 0-3 buttons, along with a list of selectable items, such as radio buttons and checkboxes.

DatePickerDialog: Used for the selection of date by the user

TimePickerDIalog: Used for the selection of time by the user

ProgressDialog: Used to display a progress bar and is an extension of the AlertDIalog. It also supports the addition of buttons.

98) Explain Sensors in Android

Answer: Android-based devices have an assortment of built-in-sensors in them, which measure certain parameters such as motion, orientation and more. These sensors help in the monitor of positioning and movement of the device through their high accuracy. The sensors can be both software and hardware-based on nature. The three prominent categories of sensors in Android devices are:

Position Sensor: It is used to measure the physical position of the Android device. This includes orientation sensors and magnetometers.

Motion Sensors: These sensors include gravity, rotational activity and acceleration sensors which measure the rotation of the device or the acceleration and much more.

Environmental Sensor: It includes sensors that measure temperature, pressure, humidity, and other environmental factors.

99) Name some testing scenarios which be tested on real devices and not on emulators.

Answer: Emulators are devices which are used to perform tasks comparable to that of real Android devices, and are used to decrease the cost of testing. But some scenarios can only be performed on real devices and not on emulators. These scenarios include:



Mounting and unmounting the memory card

Validation of battery scenarios

Memory related issues

Validation of the performance

100) What is Orientation?

Answer: Orientation is the key feature in Smartphones nowadays. It has the ability to rotate the screen between Horizontal or Vertical mode.

Android supports two types of screen Orientations as mentioned below:

Portrait: When your device is vertically aligned.

Landscape: When your device is horizontally aligned.

setOrientation() is a method using which you can set a screen alignments. HORIZONTAL and VERTICAL are two values that can be set in the setOrientation() method. Whenever there is a change in the display orientation i.e. from Horizontal to Vertical or vice versa then onCreate() method of the Activity gets fired.

Basically, when the orientation of the Android mobile device gets changed then the current activity gets destroyed and then the same activity is recreated in the new display orientation. Android developers define the orientation in the AndroidManifest.xml file.

Related Posts:

For more Interview Questions And Answers click here