0% found this document useful (0 votes)
610 views

Android Interview Questions PDF

Android is an open-source operating system primarily designed for mobile devices. It allows users to run third-party applications that can be downloaded from app stores or other sources. The document discusses common Android interview questions, covering topics such as the basic features and components of Android like activities, fragments, intents, services, and more. It also explains concepts like AsyncTask, processes, and threads in more detail.

Uploaded by

SandeepRao
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
610 views

Android Interview Questions PDF

Android is an open-source operating system primarily designed for mobile devices. It allows users to run third-party applications that can be downloaded from app stores or other sources. The document discusses common Android interview questions, covering topics such as the basic features and components of Android like activities, fragments, intents, services, and more. It also explains concepts like AsyncTask, processes, and threads in more detail.

Uploaded by

SandeepRao
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 24

ANDROID Interview Question Prof.

Sandeep Rao 8959490369

ANDROID INTERVIEW QUESTIONS

Android Interview Questions


Beginner-Level Android Interview Questions
1. What do you mean by Android?
Android is an open-source OS primarily designed for mobile devices. It is based on
the Linux kernel. It allows users to run third-party applications. Those applications
can be downloaded from the Google Play Store or other sources. Android supports
multiple hardware platforms and screen sizes, making it a versatile operating system
that can run on many devices.

2. Why do we need Android?


We need Android for the following reasons:
 It is a ubiquitous platform that allows users to access various applications
and services.

 It is an open-source platform. It can be freely modified and distributed by


developers.

 It can run on many devices, from low-end smartphones to high-end


tablets and other gadgets.

 It is highly customizable. Users can modify the look and feel of their
devices, install custom ROMs, and make other changes to the platform.

3. What are the primary features of Android?


The following are the primary features of Android:
 Customizability

 Multitasking

 Robust notification system

 Google Play Store

 Security

 Google services integration

ANDROID Interview Question Prof. Sandeep Rao 8959490369


ANDROID Interview Question Prof. Sandeep Rao 8959490369

4. What do you understand by activity in Android?


An activity in Android is a component representing a single screen with a UI(User
Interface). It is a fundamental building block of an Android application. It provides a
window where the user can interact with the application.

5. What do you mean by a fragment in Android?


A fragment in Android is a modular section of the activity. It represents a portion of
the UI and the behavior of the application. Fragments are used to address the
challenge of developing UIs. They can adapt to different screen sizes and
orientations.

6. What is a layout in Android, and what are its different types?


A layout in Android is a collection of UI(User Interface) controls. UI controls can be
buttons, text fields, images, and other widgets, that are arranged on the screen. A
layout defines how these UI controls are positioned and sized on the screen. It
provides the structure for the user interface of an Android application.
There are several types of layouts in Android:
1. LinearLayout

ANDROID Interview Question Prof. Sandeep Rao 8959490369


ANDROID Interview Question Prof. Sandeep Rao 8959490369

2. RelativeLayout

3. ConstraintLayout

4. FrameLayout

5. TableLayout

7. What do you mean by an APK in Android?


An APK (Android Package Kit) in Android is the file format used to distribute and
install applications on an Android device. It has all the necessary files and resources
required to install and run an Android application on a device. It also has the
compiled code, resources, assets, and manifest file.

8. What is a service in Android?


Service in Android is a component that runs in the background. It performs long-
running operation or task that does not require user interaction. It can be used to
perform tasks such as downloading data from the internet, playing music, or
monitoring the device's sensors.

9. What do you mean by a broadcast receiver in Android?

ANDROID Interview Question Prof. Sandeep Rao 8959490369


ANDROID Interview Question Prof. Sandeep Rao 8959490369

A broadcast receiver in Android is a component that receives and responds to


broadcast messages or events.

These messages are sent by the Android system or by other applications on the
device. They indicate changes in the device's state, such as the device's battery
level, network connectivity, or incoming phone calls.

10. What is the context in Android?


The context in Android is an abstract class. The class provides access to application-
specific resources and services. It represents the current state of the application or
activity. It also gives information about its environment, resources, and other system-
level services.
Intermediate Level Android Interview Questions
11. What do you mean by intent and its types in Android?
An Intent in Android is a messaging object. It is used to communicate between
different components of an application or between various applications. It represents
an action that needs to be performed, along with the necessary data and other
information required to perform the action. It can be used to start activities, services,
and broadcasts.
There are two primary types of intents in Android:
1. Explicit Intent: It starts a specific component of an application, such as
an activity or service, by specifying the class name of the component to

ANDROID Interview Question Prof. Sandeep Rao 8959490369


ANDROID Interview Question Prof. Sandeep Rao 8959490369

be started.

2. Implicit Intent: It starts a component that can handle a specific


action, regardless of its class name.

12. Explain the differences between Serializable and Parcelable interfaces in


Android.
Serializable and Parcelable are interfaces in Android. They allow you to serialize and
deserialize objects. So they can be passed between different components of an
application. However, there are some differences between them, which are
mentioned below.
Serializable interface Parcelable interface

When you serialize an object using Parcelable is generally faster than Serializable
Serializable, it creates a lot of temporary because it generates less garbage and involves less
objects, which can negatively impact reflection. It is designed to be more efficient and can
performance in some cases. be faster in situations where performance is a
concern.

It is less efficient than the Parcelable interface It is more efficient than Serializable. It generally
because it carries huge data streams. produces smaller data streams.

When you implement Serializable, you don't It requires you to write custom code to handle the
have to write any special methods, but the serialization and deserialization process. This gives
serialization and deserialization process is you more control over how the object is serialized
handled entirely by the Java serialization and can allow you to optimize the process for
system. performance.

Serializable is compatible with Java, so you It is specific to Android and can only be used within
can use it to pass objects between Android and the Android framework.
non-Android systems.

13. What is the Android Manifest file, and what is its purpose?
The Android Manifest file is an XML(Extensible Markup Language) file. It provides
essential information about an Android app for the Android OS. It is named
"AndroidManifest.xml" and is located in the root directory of an Android project.

ANDROID Interview Question Prof. Sandeep Rao 8959490369


ANDROID Interview Question Prof. Sandeep Rao 8959490369

The Android Manifest file has several purposes, including


 Declaring the app's package name.

 Specifying the app's components.

 Defining app permissions.

 Specifying hardware and software requirements.

 Declaring app metadata.

14. What do you mean by AsyncTask in Android?


AsyncTask in Android is a class that allows developers to perform background tasks
or operations on a separate thread from the main UI thread. It is the best way to
perform tasks that take a long time to complete without blocking the main thread.
This can cause the UI to freeze and become unresponsive. The tasks can be
network operations or heavy database transactions.
An AsyncTask in Android operates by defining a set of methods that run on the UI
thread. It also defines a set of methods that run on a separate worker thread. The
methods that run on the UI thread include onPreExecute(), onProgressUpdate(),
and onPostExecute(), while the method that runs on the worker thread

ANDROID Interview Question Prof. Sandeep Rao 8959490369


ANDROID Interview Question Prof. Sandeep Rao 8959490369

is doInBackground().

15. Explain the differences between a thread and a process in Android.


A thread and a process are two distinct concepts in Android that are used for
different purposes. A thread is a lightweight unit of execution within a process. On
the other hand, a process is a self-contained instance of an application or service. It
runs in its own memory space, with its own virtual machine (VM).
The following are the differences between them:
Thread Process

It shares resources with the parent process, It requires more resources (such as memory) than a
which can make them more efficient in terms of thread, as each process has its own set of
resource usage. resources.

Threads within a process share the same Each process is isolated from other processes,
memory space, which can make them vulnerable which provides better security and fault isolation.
to bugs and security issues.

Switching between threads is faster, as threads Switching between processes is slower than
share the same memory space and VM. switching between threads, as each process has its
own memory space and VM.

16. What is a content provider in Android?


Content provider in Android is a component that handles a shared set of app data. It
allows you to safely share data between different applications in a standardized and
secure way. They enable different apps to access, query, and modify the data stored
in the same database or file without exposing the underlying implementation details.
Content Providers use a set of standardized interfaces. They use them to define how
data can be accessed and modified. These interfaces are based on the CRUD
(Create, Read, Update, Delete) operations that are commonly used in database
management. Content Providers provide a standard, secure, and well-structured way
for applications to access data.

17. What is an SQLite database in android?


SQLite is a lightweight RDBMS(Relational Database Management System), a
software library included as a part of the Android OS. It provides a mechanism for
storing and retrieving structured data. These are used in Android applications to
store application data, such as user preferences, settings, and other data that needs
to be persisted across application runs.
SQLite databases are stored in a file on the device's file system. Any application can
have multiple SQLite databases. Each database can have multiple tables, which are
used to organize the data. The data in an SQLite database is stored in rows and
columns, much like in a spreadsheet.

18. What do you understand by the life cycle of Android activity?


The Android activity lifecycle describes how activity transitions are happening
through different states as it is created, used, and destroyed. There are different
states that an activity can be in. Each state with its own set of callbacks can be used
to handle specific events.

ANDROID Interview Question Prof. Sandeep Rao 8959490369


ANDROID Interview Question Prof. Sandeep Rao 8959490369

The following is the sequence of lifecycle events for an activity:


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

By using these lifecycle methods, an Android app can gracefully handle different
user interactions and system events and ensure that the app is efficient and
responsive at all times.

19. What is a Toast in Android, and how do we create a Toast in Android?


A Toast in Android is a small pop-up message. It displays a short message to the
user. It is used to show feedback or notification to the user without blocking the
user's interaction with the application. To create a Toast in Android, you can use the
Toast class. This class is available under android.widget package. The following
steps outline the basic process of creating and displaying a Toast:
1. Create a Toast object using the method Toast.makeText(). This method
takes three parameters. The parameters are the application context, the
message to display, and the duration for which the message should be

ANDROID Interview Question Prof. Sandeep Rao 8959490369


ANDROID Interview Question Prof. Sandeep Rao 8959490369

displayed.

2. Call the method show() on the Toast object to display the message.

Here is an example code snippet demonstrating how to create and display a simple
Toast message:
// create a Toast object with a short duration and a message to display
Toast.makeText(getApplicationContext(), "Hello, Ninjas. This is a toast",
Toast.LENGTH_SHORT).show();

20. What do you mean by application and activity context in Android?


The Application context is a global context. It is available throughout the application's
lifecycle. It is used to access application-level resources. The resources can be the
application's assets or database. You can usually obtain the application context by
calling the getApplicationContext() method from the application's class.
On the other hand, the Activity context is a context that is tied to the lifecycle of an
activity. It is used to access resources and services. Those resources and services
are specific to an activity, such as UI widgets, layouts, and preferences. You can
obtain the activity context usually by calling this keyword from the activity's class.
Advance Level Android Interview Questions
21. What are some standard techniques for optimizing the performance of an
Android application?
Optimizing the performance of an Android application is very crucial for providing a
good user experience.

ANDROID Interview Question Prof. Sandeep Rao 8959490369


ANDROID Interview Question Prof. Sandeep Rao 8959490369

There are some standard techniques for optimizing the performance of an Android
application:
 Reducing the number of layout hierarchies: The more complex the
layout hierarchy is, the more time it takes to draw and display the user
interface. Therefore, it is essential to keep the layout hierarchy as simple
as possible.

 Avoid creating unnecessary objects: Creating objects can be very


much expensive in terms of memory and CPU time. To avoid creating
unnecessary objects, you should reuse objects wherever possible.

 Using asynchronous operations: Long-running operations, such as


network requests or database queries. These should be performed
asynchronously to avoid blocking the UI thread.

 Use the proper data structure: Choosing the right data structure is
essential for the performance of your application.

 Reduce the memory footprint of your application: The less memory


your application uses, the less likely it is to be killed by the system.

ANDROID Interview Question Prof. Sandeep Rao 8959490369


ANDROID Interview Question Prof. Sandeep Rao 8959490369

22. Explain the differences between targetSdkVersion and


compileSdkVersion?
In Android development, there are two important version numbers that you need to
specify in your app's build.gradle file. These are
 compileSdkVersion
 targetSdkVersion

The compileSdkVersion specifies the version of the Android SDK(Software


Development Kit ) that your app is compiled against. It means that your app can use
the features. It can also use APIs provided by this version of the SDK. If you try to
use an API that is not available in the compileSdkVersion, then your app will fail to
build.
On the other hand, the targetSdkVersion specifies the version of the Android SDK
that your app is targeting. It means that your app is designed to work best with this
version of the SDK. If your app uses any deprecated features or behaviors, they will
still work as expected on this version of the SDK.

23. What are sensors in Android and their types?


A sensor in Android is a device or component. It can detect changes in the
environment and provide the data to the Android device.

ANDROID Interview Question Prof. Sandeep Rao 8959490369


ANDROID Interview Question Prof. Sandeep Rao 8959490369

These sensors are built into most modern Android devices and can include sensors
such as:
 Accelerometer: It detects the changes in the device's acceleration and
orientation.

 Gyroscope: It detects changes in the device's rotation and orientation.

 Magnetometer: It detects changes in the device's magnetic field.

 Proximity sensor: It detects when an object is nearby and adjusts the


device's behavior accordingly.

 Light sensor: It detects changes in the ambient light levels and adjusts
the device's brightness according to it.

 Barometer: It measures air pressure and can be used to determine


altitude and weather conditions.

 Temperature sensor: It measures the temperature of the device.

ANDROID Interview Question Prof. Sandeep Rao 8959490369


ANDROID Interview Question Prof. Sandeep Rao 8959490369

These sensors can be accessed through the Android Sensor API. It provides
developers with a simple and consistent way to access the data from these sensors.
Developers can use this data to create various applications.

24. What do you mean by a custom view in Android?


A custom view in Android is a user-defined component. It extends the capabilities of
the built-in Android view classes. These views allow developers to create unique and
customized UI components that are unavailable in the standard Android SDK.
A custom view is created by extending an existing view class, such as View,
TextView, or Button. It implements custom drawing and interaction behavior. This
can involve creating a new layout, creating custom attributes, and defining custom
event-handling logic.

25. What do you understand by RecyclerView in Android?


A RecyclerView in Android is a flexible and efficient view for displaying large data
sets, such as lists or grids. It was introduced in Android Lollipop to improve the older
ListView and GridView. It provides many benefits over these earlier implementations.
The RecyclerView is designed to be highly customizable. It provides a number of
features that make it suitable for use in a variety of applications. Some of its primary
key features are:
 Reuse of views

 Layout managers(such as LinearLayoutManager, GridLayoutManager,


and StaggeredGridLayoutManager)

 Item decorations

 Item animations

 Adapter-based data binding

26. What do you mean by an adapter in Android, and why do we need this?
An adapter in Android is a necessary component that connects a data source to a
view. It creates views for data items and manages the data and views binding. It
provides a bridge between the data source and the UI. It is responsible for creating
the views that represent the data. It also manages the data as it is displayed to the
user. An adapter extends the BaseAdapter or RecyclerView.Adapter class to provide
the necessary functionality.
Adapters in Android are commonly used to populate views such as ListView,
GridView, and RecyclerView. They are also used in other UI components such as
Spinners, AutoCompleteTextView, and SearchView.

27. What do you mean by Android NDK?


The Android NDK (Native Development Kit) is a toolset. It allows developers to build
Android apps using native code languages like C and C++, in addition to Java and
Kotlin, which are the primary languages used for Android development.
The NDK provides a set of headers and libraries. It allows developers to write native
code that can be compiled into shared libraries that can be loaded and used by an
Android application. All these shared libraries can be accessed using Java Native
Interface (JNI), which allows the Java code to call the native code.

ANDROID Interview Question Prof. Sandeep Rao 8959490369


ANDROID Interview Question Prof. Sandeep Rao 8959490369

There are several reasons why a developer chooses Android NDK:


 Performance

 Porting existing code

 Accessing native libraries

28. What do you mean by a job scheduler in Android?


A job scheduler in Android is a system service. It allows developers to schedule
tasks to run at specific times or under specific conditions, like when the device is
charging or when the network is available.
With a job scheduler in Android, developers can offload tasks. It would otherwise
require the app to run constantly or at specific intervals. This can help to improve
battery life and reduce the amount of data the app uses.

29. Why do we use the AVD manager?


AVD stands for Android Virtual Device. It is a tool used in Android development. It
allows developers to create, configure, and manage virtual devices that simulate the
behavior of real Android devices. The AVD Manager creates different virtual devices
with different screen sizes, resolutions, and other hardware configurations. These
virtual devices can help developers to test their applications across a range of
devices and configurations without the need for physical devices.
This can be done by selecting the target API level. Then you need to specify the
device's screen size, resolution, and other hardware configurations and add the
required system images and optional features. When an AVD is created, it can be
launched in the Android emulator. It will allow developers to test and debug their
applications, like running an application on a physical device.

30. Explain the purpose of the Android Resource system.


The Android Resource system is an essential component of the Android OS. It is
used to manage and organize the resources that are used by an application. The
resources can be images, text, layouts, strings, colors, and styles.
The primary purpose of the Android Resource system is to provide a centralized
location. It gives the location for storing all the resources that an application needs to
function correctly. It makes it easier to manage and update all these resources
throughout the application's development lifecycle.
There are some features and benefits of the Android Resource system:
 It allows for localization.

 It facilitates the development of responsive applications.

 It simplifies the management of application assets.

 It enables theme customization.

ANDROID Interview Question Prof. Sandeep Rao 8959490369


ANDROID Interview Question Prof. Sandeep Rao 8959490369

Basic Level Interview Questions


1. Explain the build process in Android.
The build process in Android has 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
R.java, 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 apk builder is required to take all the inputs
and build the Android Packaging Key (APK) file.

2. Name some Android programming languages.

The following is a list of the most popular programming languages that can be used
to develop applications for Android:

 Java: One of the most popular programming languages, Java has always been a
starting point for new developers and is used by many 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.

ANDROID Interview Question Prof. Sandeep Rao 8959490369


ANDROID Interview Question Prof. Sandeep Rao 8959490369

3. What are the different tools available in Android development? Explain


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

4. Explain the Android Interface Definition Language.


Android Interface Definition Language or AIDL facilitates the communication
between the client and service. For the procedure of communication between
processes, the data is split into small portions which are easily recognized by the
Android platform.

5. Describe Folder, File & Description of Android Applications


The following are brief explanations of these concepts:

 gen: gen contains the compiler-generated .R file which references all the resources
in the project
 src: src holds the .java source files in our project
 bin: bin contains the .apk file built by the ADT during the build process, along with all
the other things needed to run an Android application
 AndroidManifest.xml: This file is the manifest file that explains the basic features of
the application and defines all its components
 res/values: res/values is a directory for other various XML files that contain
resources such as strings, color definitions and more
 res/drawable-hdpi: This is a directory for objects that are drawable and designed for
high-density screens
 res/layout: It is a directory of files that define the UI for your application

6. What are ‘activities’? Describe the lifecycle of an activity.


Activities are referred to as a window to the user interface. It helps in the display of
output or could even ask for inputs so that the dialog boxes and other roles can be
performed to create a user interface. The lifecycle of an activity is as follows

 OnCreate(): The views are created and data is collected from bundles
 OnStart(): Called if the activity is visible to the user. It may be succeeded by
onResume() if the activity reaches the foreground and onStop() if it converts into
hidden.
 OnResume(): Called when the activity starts an interaction with the user

ANDROID Interview Question Prof. Sandeep Rao 8959490369


ANDROID Interview Question Prof. Sandeep Rao 8959490369

 OnPause(): Called when the activity is going to the background but hasn’t been
killed yet
 OnStop(): Called when you are no longer visible to the user
 OnDestroy(): Called when the activity is finishing
 OnRestart(): Called after the activity has been stopped, prior to it being started again

7. State some advantages of Android.


These are some advantages of Android:

 Low investment and better returns: Android development has a low entry barrier
and is suitable for new developers looking to become proficient in the programming
field
 Free SDK: One of the most prominent features of Android is that the Software
Development Kit is open source and is provided free of charge, which eradicates the
cost of licensing distribution and development fee
 Easy Adoption: Android applications are scripted in Java, which is one of the most
used programming languages in the world
 Reusable: Android components can be reused and even replaced by the framework
 Multi-Platform Support: The Android platform supports major OSs such as Linux,
Mac OS, and Windows
 Support for Wearable Devices: The market is now flooded with wearable devices
and Android has emerged as leading support for such devices that are now readily
available in the market

8. What are some of the disadvantages of Android?


The following are some disadvantages of the Android Operating System

 Fake Applications: There are thousands of fake apps available on the market at any
given time, which when installed may try to steal your data.
 Streamlining issues: There are a variety of Android devices available in the market,
with different screen sizes and dimensions, but more importantly, different Android
Operating Systems. Every application developer has to constantly work towards
updating their application for the new OS but with various OS versions and upgrades,
the process is quite difficult. An application that runs smoothly on one version of the
Android OS might crash on a different Android OS.
 Background Processes: The abundance of running processes in the background is
always an issue, as they eat up the battery quickly.

9. Define the architecture of Android.


The Android architecture consists of five components. These are:

 Linux Kernel: The Linux Kernel forms the basis of the Android platform, and this
powers features such as memory and power management, and various drivers. It
serves as an abstraction layer before the other layers.
 Platform Libraries: Android’s platform libraries are native C and C++ libraries that
provide support for graphics and media, and a WebKit library. This allows developers
to implement graphic functionality and display web content, among other things.
 Android Runtime: Android Runtime (ART) and the core libraries are among the
most significant parts of the architecture. It serves as the foundation for the
application framework, and has features like optimized garbage collection.

ANDROID Interview Question Prof. Sandeep Rao 8959490369


ANDROID Interview Question Prof. Sandeep Rao 8959490369

 Android applications: This is what you see when you use your phone, and is the
top level of the architecture. Core apps like email, SMS, and contacts come pre-
installed.
 Application Framework: The application framework contains classes that are used
in the creation of an application. They provide the building blocks with which you can
create apps, and provide services such as a resource manager, notification manager,
and activity manager.

10. What is an “Emulator”?


An "Emulator" in Android helps the developers play around with an interface that
acts as a real mobile device. This way, it becomes easier for the developers to write
and test different codes for the application. The process of debugging also becomes
possible through emulators. Thus, emulators provide a safe platform for testing
codes in their early phases as well as in the later stage when the bugs need to be
dealt with.
11. What is an Activitycreator?
An Activitycreator is an initial step towards the creation of the Android project. It
consists of the shell script that can be used for creating a new file system that is
necessary for writing codes within the Android system.

12. What is Android Runtime?


Android Runtime (ART) is an application used by the Android OS as a runtime
environment. It has now replaced Dalvik, a discontinued Virtual Machine (VM). ART
translates the bytecode of the application into native instructions, which are carried
out by the device’s runtime environment.
13. Explain the term ANR.
The term ANR is short for Application Not Responding. It is displayed as a
notification by the Android OS every time the application stops responding to the
user's action for a considerable amount of time.

14. Explain the dialog boxes supported on Android.


Android supports four dialog boxes:

 AlertDialog: 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.

15. What are Android Frameworks?


Android frameworks are a set of APIs that make the development process easier.
Developers can write apps quickly because APIs provide tools like intents, text fields,
and more. It is essentially a software tool kit that allows for quick construction of the
skeleton of an application.

ANDROID Interview Question Prof. Sandeep Rao 8959490369


ANDROID Interview Question Prof. Sandeep Rao 8959490369

16. What is an API in Android?


An Application Programming Interface (API) is simply a set of specifications or rules
that determine how software components can interact with each other. Companies
that release an API do so to let developers design products around the services it
provides.

Intermediate Level Interview Questions


17. What are Sensors in Android?
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 to monitor the positioning and movement of the device with high accuracy. They
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

18. Name some testing scenarios for real devices, not on emulators.
Emulators are devices that 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. These scenarios
include:

 Messaging
 Bluetooth
 Mounting and unmounting the memory card
 Validation of battery scenarios
 Memory related issues
 Validation of the performance

19. What is Context?


Context in Android, as its name suggests, is the context of the current state of your
application or object. The context comes with services such as giving access to
databases and preferences, resolving resources, and much more.
There are two types of context:

 Activity Context: This context is attached to the lifecycle of an activity. It should 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 current context.
 Application Context: This context is attached to the lifecycle of an application. The
application context can be used where you need a context whose lifecycle is

ANDROID Interview Question Prof. Sandeep Rao 8959490369


ANDROID Interview Question Prof. Sandeep Rao 8959490369

separate from the current context or when you are passing a context beyond the
scope of activity.

20. How do you find memory leaks in an application on the Android


platform?
The Android Device Manager (ADM) helps find memory leaks in an application on
Android. When you open ADM in Android Studio, you can see parameters such as
heap size and memory analysis along with many others while you run an application.

21. State the architecture of an Android application.


Any Android application has the following components:

 Notification: Offers features such as light, sound, icons, etc.


 Services: Performs background functionalities
 Intent: Performs inter-connection between activities and mechanisms that pass on
data
 Resource Externalization: Offers features such as strings and graphics
 Content Providers: Shares data between applications

22. How do you troubleshoot an application that crashes frequently?


The following actions can help diagnose an Android application that crashes
frequently:

 Free Memory: As there is a limited amount of space on mobile devices, you can try
by freeing up memory space for the application to function properly
 Compatibility Check: It may not be a hardware problem, but more of a software
issue. It is not always possible to test an application for all devices and Operating
Systems. There might be a chance that the application is not compatible with your
OS, so check the compatibility on the application’s Google Play Store page.
 Memory Management: Some applications run perfectly on one mobile device but
may crash on other devices. This is where processing power, memory management,
and CPU speed come into play. Check the application memory requirements if the
application crashes constantly.
 App Data Usage: 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

23. Explain DDMS in brief.


The Dalvik Debug Monitor Server (DDMS) is a debugging tool in Android Studio. It
has a wide range of debugging features, such as:

 Port forwarding
 Location data spoofing
 Screen capture
 Logcat
 Radio state information
 Thread and Heap information

ANDROID Interview Question Prof. Sandeep Rao 8959490369


ANDROID Interview Question Prof. Sandeep Rao 8959490369

The DDMS tool is now deprecated and Android now suggests the users use Android
Profiler instead.

24. Explain the difference between implicit and explicit intent.


Below is the difference between the two intents

 Explicit Intent: An explicit intent is where you inform the system about which activity
or system component it should use to generate a response to this intent.
 Implicit Intent: An implicit intent allows you to declare the action you wish to carry
out, after which the Android system will check which components are registered to
handle that specific action.

25. What is the AndroidManifest.xml file and why do you need this?
The AndroidManifest.xml file contains information about the application, which is
then provided to the Android system. This data may include the package name,
components such as activity, services, content providers, and more. This file
executes the following tasks:

 Providing a unique name to the Java package


 Describing various components of the application, such as activity, services, and
more. It also defines the classes which will implement these components.
 Declaring the Android API which will be used by the application
 Holding the library file details linked to the application

26. Explain the different launch modes in Android.


These are the different launch modes in Android:

 Standard: This launch mode generates a new instance of the activity in the task from
which it originated. It is possible to create multiple instances of the same activity,
which can be added to the same or different tasks.
 SingleTop: This launch mode is similar to the Standard launch mode, except if there
exists a previous instance of the activity on the top of the stack, then a new instance
will not be created, but the intent will be sent to the existing instance of the activity.
 SingleTask: This launch mode will always create a new task and push a new
instance to the task as the root one.
 SingleInstance: This launch mode is the same as the SingleTask launch mode but
the system doesn’t launch any new activities in the same task. In a scenario where
the new activity is launched, it is launched in a separate task.

Advanced Level Interview Questions


27. State the components which are necessary for a New Android Project
When a new Android project is created, the following components are required:

 Manifest: Contains the XML file


 Build/: Contains build output
 Res/: Contains non-code resources such as bitmap images, UI strings and more
 Src/: Contains the code and resources
 Assets/: Contains a file which can be converted into an .apk file

ANDROID Interview Question Prof. Sandeep Rao 8959490369


ANDROID Interview Question Prof. Sandeep Rao 8959490369

28. What is the importance of setting up permission in Android application


development?
If the code is accessible to anyone and without restrictions, there may be a scenario
where the code is compromised, resulting in defect leakage. Once the permissions
are set, the code becomes available to authorized users only.
29. What are the different data types supported by AIDL?
AIDL or Android Interface Definition Language facilitates the communication
between the client and service. Data Types supported by AIDL are as follows:

 String
 List
 Map
 charSequence
 INT, Long, Char, Boolean (Java data types)

30. Name the different data storage options available on the Android
platform.
Android platform provides a variety of data storage options that can be used
depending on the need of the user. The storage options are:

 SharedPreference: Stores data in XML files


 SQLite: Stores structured data in the private database
 Internal Storage: Stores data in the device file system where it cannot be read by
other applications
 External Storage: Stores data in the file system but it can be accessed to all apps in
the device

31. Is there any difference between activities and services?


Yes, there are a lot of differences between activities and services. These differences
are stated as under:

Activities Services

Closed Open

Can be terminated at any time Cannot be terminated at any time

Not designed to run behind the scenes Designed to run behind the scenes

Does not act independently Act independently

ANDROID Interview Question Prof. Sandeep Rao 8959490369


ANDROID Interview Question Prof. Sandeep Rao 8959490369

32. What is the use of XML-based layouts?


The XML-based layouts help inconsistent and standard format for setting up of GUI
definition format. The layout details are placed in XML files, and the other items are
put in source files.

33. Explain what containers are in the Android system.


The containers in the Android system help hold objects and widgets together so that
the specific items and arrangements can be fulfilled. These containers include labels,
buttons, fields, etc.

34. What is ADB?


ADB is Android Debug Bridge, which helps developers create remote shell
commands. The main function of ADB is to allow and control the communication
process towards the emulator port and get a response from it.

35. What are the states in an activity?


There are four states in an activity. These include the following.

1. Active state: The activity is in the foreground


2. Paused state: The activity is in the background and visible
3. Stopped state: The activity is in the background but not visible, even hidden or
obscuring other activities
4. Destroyed state: The activity is completely terminated or killed/removed

36. What are the permissions in the application development process?


Permissions in the application development process include restrictions that are
imposed to protect the data and code. These permissions are applied to protect the
application from getting compromised, attacked by viruses, stealing users'
information, and causing bugs.
37. What are the intent filters?
Intent filters are the vital components of the Android system because it helps in
responding, filtering, and receiving information inputs.
38. Are there any critical loops while monitoring an activity?
Yes, there are three key loops when monitoring an activity. These are:

 Loop 1, Entire Lifetime: The activity happens between onCreate and onDestroy.
 Loop 2, Visible Lifetime: The activity happens between onStart and onStop
 Loop 3, Foreground Lifetime: The activity happens between onResume and
onPause

39. What are the possible states in which a process is based?


The possible states in which a process is based include the following:

 State 1: Foreground activity


 State 2: Visible activity

ANDROID Interview Question Prof. Sandeep Rao 8959490369


ANDROID Interview Question Prof. Sandeep Rao 8959490369

 State 3: Background activity


 State 4: Empty activity

40. Can we prevent ANR in the Android system?


Yes, we can prevent ANR in the Android system. ANR hinders the Android system
from ending code that has been responsive for a long time. The prevention can be
made by creating a child thread wherein most of the actual workings of the codes
can be applied, and the minimum period of unresponsive times can be revealed.

41. What are Default Resources? How are they useful?


The default resources include the default strings and files. Their absence will result
in creating errors on the screen and could also hinder the running of the downloaded
application. They are useful as they are placed as subdirectories under the project
directory, which supports the running of the downloaded application.

42. What is a Fragment in Android?

ANDROID Interview Question Prof. Sandeep Rao 8959490369

You might also like