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

Interview Questions Android

The document provides information about Android architecture and components. It describes that Android is an open-source operating system used on mobile devices and consists of five layers - Linux kernel, libraries, Android runtime, Android framework, and applications. It also defines key concepts like activities, services, the Android SDK tools, and adapters.

Uploaded by

A B Sagar
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
63 views

Interview Questions Android

The document provides information about Android architecture and components. It describes that Android is an open-source operating system used on mobile devices and consists of five layers - Linux kernel, libraries, Android runtime, Android framework, and applications. It also defines key concepts like activities, services, the Android SDK tools, and adapters.

Uploaded by

A B Sagar
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 52

1. What is Android?

Android is an open-sourced operating system that is used on mobile devices, such as mobiles and tablets. The
Android application executes within its own process and its own instance of Dalvik Virtual Machine(DVM) or
Android RunTime(ART).

2. What are the features of Android architecture?

Android architecture refers to the various layers in the Android stack. It consists of operating systems,
middleware, and applications. Each layer in the Android architecture gives different services to the layer just
above it.

The five layers present in the Android stack are:

 Linux Kernel - It is responsible for device drivers, device management, memory management, power
management, and resource access.
 Libraries - There are a set of libraries having open-source Web browser engine WebKit, well-known
library libc, libraries to play and record audio and video, SQLite database for sharing of application data
and storage, SSL libraries for internet security, etc.
 Android Runtime - There are core libraries along with DVM (Dalvik Virtual Machine) or ART(Android
RunTime) as runtime which is helpful for running an Android application. DVM is optimized for mobile
devices. DVM provides fast performance and consumes less memory. Replacing DVM, ART(Android
RunTime) virtual machine was introduced to execute android apps from Android lollipop 5.0 version
(API level 21).
 Android Framework - It consists of Android APIs like UI (User Interface), resources, content providers
(data), locations, telephony, and package managers. It provides interfaces and classes for the
development of Android applications.
 Android Applications - Applications like home, games, contacts, settings, browsers, etc. uses the
Android framework that will make use of Android runtime and libraries.

Android
Architecture
3. 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.

4. What is an activity?

Activity in java 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.

For example, the Facebook start page where you enter your email/phone number and password to log in acts as
an activity.

5. What is a service 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.

6. Differentiate Activities from Services.

Activities can be terminated or closed anytime the user wishes. On the other hand, services are designed to run
in the background, and they can act independently.

Most of the services run continuously, irrespective of whether there are certain or no activities being executed.

Activities Services
They are designed to run in the These are mainly designed to run in the background. Foreground services
foreground. are also available.
Used when the user interface is
Used when the user interface is not necessary.
necessary.
They are dependent. They act independently.

7. What is Google Android SDK? Which are the tools placed in Android SDK?

The Google Android SDK is a toolset used by developers to write applications on Android-enabled devices.

The tools placed in Android SDK are given below:


 Android Emulator - Android Emulator is a software application that simulates Android devices on your
computer so that you can test the application on a variety of devices and Android API levels without
having each physical device.
 DDMS(Dalvik Debug Monitoring Services) - It is a debugging tool from the Android software
development kit (SDK) which provides services like message formation, call spoofing, capturing
screenshots, etc.
 ADB(Android Debug Bridge) - It is a command-line tool used to allow and control communication with
the emulator instance.
 AAPT(Android Asset Packaging Tool) - It is a build tool that gives the ability to developers to view,
create, and update ZIP-compatible archives (zip, jar, and apk).

8. 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();


b.putString("Email","[email protected]");
i.putExtras(b); // where i is intent

9. What is an Adapter in Android?

An adapter in Android acts as a bridge between an AdapterView and the underlying data for that view. The
adapter holds the data and sends the data to the adapter view, the view can take the data from the adapter view
and shows the data on different views like a spinner, list view, grid view, etc.

10. What is AAPT?

AAPT stands for Android Asset Packaging Tool. It is a build tool that gives the ability to developers to view,
create, and update ZIP-compatible archives (zip, jar, and apk). It parses, indexes, and compiles the resources
into a binary format that is optimized for the platform of Android.

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

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

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

14. What is AIDL? Which data types are supported by AIDL?

AIDL(Android Interface Definition Language) is a tool that handles the interface requirements between a client
and a service for interprocess communication(IPC) to communicate at the same level.

The process involves dividing an object into primitives that are understood by the Android operating system.
Data Types supported by AIDL is as follows:

 String
 List
 Map
 CharSequence
 Java data types (int, long, char, and boolean)

Android Intermediate Questions


15. What is the 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.
Life Cycle of Android

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

17. Explain the dialog boxes supported on Android.

Android supports four dialog boxes. They are:

 AlertDialog:
o The AlertDialog supports 0-3 buttons, along with a list of selectable items such as checkboxes
and radio buttons.
o 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.
 DatePickerDialog:
o It is used for selecting the date by the user.
 TimePickerDialog:
o Used for selecting the time by the user.
 ProgressDialog:
o It is an extension of the AlertDialog and is used to display a progress bar. It also supports the
addition of buttons.
o 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.

18. 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:
o Providing a unique name to the java package.
o Describing various components of the application such as activity, services, and many more.
o Defining the classes which will implement these components.

19. What is an intent?

An intent is a messaging object that is used to request an action from other components of an application. It can
also be used to launch an activity, send SMS, send an email, display a web page, etc.

It shows notification messages to the user from within an Android-enabled device. It alerts the user of a
particular state that occurred. There are two types of intents in Android:

 Implicit Intent- Used to invoke the system components.


 Explicit Intent- Used to invoke the activity class.
Types Of Intents

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

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

Syntax:

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

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

Types of Context

23. 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");
startactivity(i);

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 bit.com"));


startActivity(i);

24. What is ANR in Android? What are the measures you can take to avoid ANR?
ANR(Application is Not Responding) is a dialog box that appears when the application is not responding. This
ANR dialogue is displayed whenever the main thread within an application has been unresponsive for a long
time under the following conditions:

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


 When a broadcast receiver has not completed its execution within 10 seconds.

Following measures can be taken to avoid ANR:

 An application should perform lengthy database or networking operations in separate threads to avoid
ANR.
 For background task-intensive applications, you can lessen pressure from the UI thread by using the
IntentService.

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

26. Explain different launch modes in Android.

The different launch modes in Android are given below:

Standard:

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

SingleTop:

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

SingleTask:

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

SingleInstance:

 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:
o A -> B -> C
o D, If you call activity E, then it will be added to the first stack.
o A -> B -> C -> E
o 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().

27. What are containers?

Containers carry objects and widgets together, based on which specific items are required and in what particular
arrangement is needed. Containers may hold labels, buttons, fields, or even child containers, etc. For example, if
you want a form with fields on the left and labels on the right, you will need a container. If you want the OK
and Cancel buttons to be below the rest of the form, next to one another, and flush to the right side of the screen,
you will need a container. If you have several widgets, you will need a container to have a root element to place
the widgets inside.

Android provides a collection of view classes that serve as containers for views. These container classes are
called layouts, which are defined in the form of XML files that cannot be changed by our code during
execution. The layout managers provided by Android SDK are LinearLayout, RelativeLayout, FrameLayout,
AbsoluteLayout, GridLayout, and TableLayout.

28. What is the role of Dalvik in Android development?

Dalvik serves as a virtual machine, and it is responsible for running every Android application. Because of
Dalvik, a device will have the ability to execute multiple instances of virtual machines efficiently through better
memory management.

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

Android Interview Questions For Experienced


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

31. Explain in detail about the important file and folders used when you create a new
Android application.

App:

It describes the basic characteristics of the application and defines each of its components.

java:

 This contains the .java source files and .kt(source code written in Kotlin) source files of your project. By
default, it includes a MainActivity.java or MainActivity.kt source file.
 You create all the activities which have .java and .kt extensions under this file and also it includes all the
code behind the application.

res:

 It is used to store the values for the resources that are used in various Android projects to include
features of color, styles, dimensions, etc.
 It is a directory for files like styles.xml, strings.xml, colors.xml, dimens.xml, etc.

Scripts:

This is an auto-generated file that consists of compileSdkVersion, buildToolsVersion, minSdkVersion,


targetSdkVersion, applicationId, versionCode, and versionName. For example, build.gradle is a script file
placed in the root project directory, defines build configurations that will be applied to all modules in your
project.

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

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:

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

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

33. What database is used in Android? How it is different from client-server database
management systems?

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

34. What are the differences between Service and Thread?

The main difference between Service and Thread is given below:

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

35. What is the content provider? How it is implemented?

Content provider is one of the primary building blocks of Android applications, which manages access to a
central repository of data. It acts as a standard interface that connects data in one process with code running in
another process. So it can be used to share the data between different applications.

They are responsible for encapsulating the data and providing mechanisms for defining data security. It is
implemented as a subclass of ContentProviderclass and must implement a set of APIs that will enable other
applications to perform transactions.

public class MyContentprovider extends ContentProvider


{
public void onCreate(){}
}

36. 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.
37. What is the difference between compileSdkVersion and targetSdkVersion?

compileSdkVersion:

 The compileSdkVersion is the version of API the application is compiled against. You can use Android
API features involved in that version of the API (as well as all previous versions).
 For example, if you try and use API 15 features but set compileSdkVersion to 14, you will get a
compilation error. If you set compileSdkVersion to 15 you can still run the app on an API 14 device as
long as your app’s execution paths do not attempt to invoke any APIs specific to API 15.

targetSdkVersion:

 The targetSdkVersion indicates that you have tested your app on (presumably up to and including) the
version you specify. This is like a certification or sign-off you are giving the Android OS as a hint to
how it should handle your application in terms of OS features.
 For example, setting the targetSdkVersion value to “11” or higher permits the system to apply a new
default theme (Holo) to the application when running on Android 3.0 or higher. It also disables screen
compatibility mode when running on larger screens (because support for API level 11 implicitly
supports larger screens).

38. Explain about java classes related to the use of sensors on Android.

Android sensor API provides many classes and interface for the use of sensors on Android. The important
classes and interfaces of sensor API are given below:

 Sensor class: This class helps you to create an instance of a specific sensor. It provides methods that let
you determine a sensor’s capabilities.
 SensorManager class: This class is used to create an instance of the sensor service. It provides methods
to access and list sensors, to register and unregister sensor listeners, etc.
 SensorEvent class: This Java class is used to create a sensor event object. It provides information about
the sensor event including raw sensor data, the accuracy of data, type of sensor, timestamp of event, etc.
 SensorEventListener interface: This interface is used to create two callback methods that receive
sensor event notifications when sensor value changes or when sensor accuracy changes. Those two
methods are void onAccuracyChanged(Sensor sensor, int accuracy) which is called when
sensor accuracy is changed and
void onSensorChanged(SensorEvent event) which is called when sensor values are changed.

39. What is JobScheduler?

The JobSchedular API is used for scheduling different types of jobs against the framework that will be executed
in your app’s own process. This allows your application to perform the given task while being considerate of
the device’s battery at the cost of timing control.

The JobScheduler supports batch scheduling of jobs. The Android system can combine jobs for reducing battery
consumption. JobManager automatically handles the network unreliability so it makes handling uploads easier.

Here is some example of a situation where you would use this job scheduler:

 Tasks that should be done when the device is connected to a power supply.
 Tasks that require a Wi-Fi connection or network access.
 Tasks should run on a regular basis as a batch where the timing is not critical.
1) What is Android?

Android is an open-source, Linux-based operating system used in mobiles, tablets, televisions, etc.

2) Who is the founder of Android?

Andy Rubin.

3) Explain the Android application Architecture.

Following is a list of components of Android application architecture:

 Services: Used to perform background functionalities.


 Intent: Used to perform the interconnection between activities and the data passing mechanism.
 Resource Externalization: strings and graphics.
 Notification: light, sound, icon, notification, dialog box and toast.
 Content Providers: It will share the data between applications.

4) What are the code names of android?

1. Aestro
2. Blender
3. Cupcake
4. Donut
5. Eclair
6. Froyo
7. Gingerbread
8. Honeycomb
9. Ice Cream Sandwich
10. Jelly Bean
11. KitKat
12. Lollipop
13. Marshmallow

More details...

5) What are the advantages of Android?

Open-source: It means no license, distribution and development fee.

Platform-independent: It supports Windows, Mac, and Linux platforms.


Supports various technologies: It supports camera, Bluetooth, wifi, speech, EDGE etc. technologies.

Highly optimized Virtual Machine: Android uses a highly optimized virtual machine for mobile devices,
called DVM (Dalvik Virtual Machine).

6) Does android support other languages than java?

Yes, an android app can be developed in C/C++ also using android NDK (Native Development Kit). It makes
the performance faster. It should be used with Android SDK.

7) What are the core building blocks of android?

The core building blocks of Android are:

 Activity
 View
 Intent
 Service
 Content Provider
 Fragment etc.

More details...

8) What is activity in Android?

Activity is like a frame or window in java that represents GUI. It represents one screen of android.

9) What are the life cycle methods of android activity?

There are 7 life-cycle methods of activity. They are as follows:

1. onCreate()
2. onStart()
3. onResume()
4. onPause()
5. onStop()
6. onRestart()
7. onDestroy()

More details...

10) What is intent?


It is a kind of message or information that is passed to the components. It is used to launch an activity, display a
web page, send SMS, send email, etc. There are two types of intents in android:

1. Implicit Intent
2. Explicit Intent

11) How are view elements identified in the android program?

View elements can be identified using the keyword findViewById.

12) Define Android toast.

An android toast provides feedback to the users about the operation being performed by them. It displays the
message regarding the status of operation initiated by the user.

13) Give a list of impotent folders in android

The following folders are declared as impotent in android:

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

14) Explain the use of 'bundle' in android?

We use bundles to pass the required data to various subfolders.

15) What is an application resource file?

The files which can be injected for the building up of a process are called as application resource file.

16) What is the use of LINUX ID in android?

A unique Linux ID is assigned to each application in android. It is used for the tracking of a process.
17) Can the bytecode be written in java be run on android?

No

18) List the various storages that are provided by Android.

The various storage provided by android are:

 Shared Preferences
 Internal Storage
 External Storage
 SQLite Databases
 Network Connection

19) How are layouts placed in Android?

Layouts in Android are placed as XML files.

20) Where are layouts placed in Android?

Layouts in Android are placed in the layout folder.

21) What is the implicit intent in android?

The Implicit intent is used to invoke the system components.

22) What is explicit intent in android?

An explicit intent is used to invoke the activity class.

23) How to call another activity in android?

1. Intent i = new Intent(getApplicationContext(), ActivityTwo.class);


2. startActivity(i);

24) What is service in android?


A service is a component that runs in the background. It is used to play music, handle network transaction, etc.

More details...

25) What is the name of the database used in android?

SQLite: An opensource and lightweight relational database for mobile devices.

More details...

26) What is AAPT?

AAPT is an acronym for android asset packaging tool. It handles the packaging process.

27) What is a content provider?

A content provider is used to share information between Android applications.

28) What is fragment?

The fragment is a part of Activity by which we can display multiple screens on one activity.

29) What is ADB?

ADB stands for Android Debug Bridge. It is a command line tool that is used to communicate with the emulator
instance.

30) What is NDK?

NDK stands for Native Development Kit. By using NDK, you can develop a part of an app using native
language such as C/C++ to boost the performance.

31) What is ANR?

ANR stands for Application Not Responding. It is a dialog box that appears if the application is no longer
responding.
32) What is the Google Android SDK?

The Google Android SDK is a toolset which is used by developers to write apps on Android-enabled devices. It
contains a graphical interface that emulates an Android-driven handheld environment and allows them to test
and debug their codes.

33) What is an APK format?

APK is a short form stands for Android Packaging Key. It is a compressed key with classes, UI's, supportive
assets and manifest. All files are compressed to a single file is called APK.

34) Which language does Android support to develop an application?

Android applications are written by using the java (Android SDK) and C/C++ (Android NDK).

35) What is ADT in Android?

ADT stands for Android Development Tool. It is used to develop the applications and test the applications.

36) What is View Group in Android?

View Group is a collection of views and other child views. It is an invisible part and the base class for layouts.

37) What is the Adapter in Android?

An adapter is used to create a child view to present the parent view items.

38) What is nine-patch images tool in Android?

We can change bitmap images into nine sections with four corners, four edges, and an axis.

39) Which kernel is used in Android?

Android is a customized Linux 3.6 kernel.


40) What is application Widgets in Android?

Application widgets are miniature application views that can be embedded in other applications and receive
periodic updates.

41) Which types of flags are used to run an application on Android?

Following are two types of flags to run an application in Android:

 FLAG_ACTIVITY_NEW_TASK
 FLAG_ACTIVITY_CLEAR_TOP

42) What is a singleton class in Android?

A singleton class is a class which can create only an object that can be shared by all other classes.

43) What is sleep mode in Android?

In sleep mode, CPU is slept and doesn't accept any commands from android device except Radio interface layer
and alarm.

44) What do you mean by a drawable folder in Android?

In Android, a drawable folder is compiled a visual resource that can use as a background, banners, icons, splash
screen, etc.

45) What is DDMS?

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

1. Port forwarding services


2. Screen capture
3. Thread and heap information
4. Network traffic tracking
5. Location data spoofing

46) Define Android Architecture?


The Android architecture consists of 4 components:

1. Linux Kernal
2. Libraries
3. Android Framework
4. Android Applications

More details...

47) What is a portable wi-fi hotspot?

The portable wi-fi hotspot is used to share internet connection to other wireless devices.

48) Name the dialog box which is supported by Android?

 Alert Dialog
 Progress Dialog
 Date Picker Dialog
 Time picker Dialog

49) Name some exceptions in Android?

 Inflate Exception
 Surface.OutOfResourceException
 SurfaceHolder.BadSurfaceTypeException
 WindowManager.BadTokenException

50) What are the basic tools used to develop an Android app?

 JDK
 Eclipse+ADT plugin
 SDK Tools

1: For starters, what’s Android anyway?

Android is a Linux-based, open-sourced operating system commonly found on mobile devices, such as
smartphones and tablets. It’s a kernel-based system that gives developers the flexibility to design and deploy
simple and/or advanced apps.

2: What is the current version of Android, and how old is it?

The current version of Android is 9.0, also called Android Pie, and it came out in August of 2018.
3: What database is used for the Android platform?

SQLite, an open-source, self-contained, serverless database, is embedded in Android by default.

4: What is an android application architecture?

The Android architecture consists of:

 Android Framework
 Android Applications
 Linux Kernel
 Libraries

5: Can you change an application’s name after you have deployed it?

Although you CAN change it, the real question should be “SHOULD you”? Changing an application’s name
risks breaking some of its functionality.

6: Name the basic tools for developing an Android App

The tools used for development are:

 JDK
 SDK Tools
 Eclipse+ADT Plugin

7: List of Android’s advantages.

The four main advantages of Linux are:

 Open source, so it’s free


 It’s platform-independent, so it supports Windows, Linux, and Mac
 It supports a number of different technologies, such as Bluetooth, speech, cameras, Wi-Fi, etc.
 It employs DVM (Dalvik Virtual Machine), a highly optimized virtual machine

8: Explain the Android SDK.

This is a set of tools that Android developers use in order to develop or write apps. It features a graphical user
interface that emulates a handheld, Android-driven environment, making it easier for developers to create, test,
and debug their code.

The tools include:

 Dalvik Debug Monitoring Services


 Android Emulator
 Android Asset Packaging Tool
 Android Debug Bridge

9: Speaking of emulators, why is it so important for developers to have access to one?


Since emulators function like an actual hand-held device, developers have a good dedicated “sandbox” to safely
create, edit, test, and debug new applications, seeing how they would function on a real device without having
to actually risk a real device.

10: What languages does Android use?

Android-primarily uses Java, but it also supports C/C++, which, if used with Android SDK, will run faster.

11: What’s an android framework?

It’s a set of APIs that permits developers to create apps, and consists of:

 Intent
 Activities
 Content Providers
 Others

12: What’s an intent in the context of Android? Describe the different types.

Much what it sounds like, it’s the intention to perform an action, a message that is passed between components.
Intents request actions from a different component, such as sending an email, opening a web page, or launch a
given activity. The two types are:

 Implicit Intent

This is where the intent doesn’t define the target component, requiring the Android system to conduct an
evaluation of the components.

 Explicit Intent

On the other hand, the explicit intent directly identifies the target component.

13: What’s a sticky intent?

This is a broadcast using the send sticky broadcast() method. The intent sticks around after the broadcast, which
allows others to collect data from it.

14: What are Activities?

These are the parts of a mobile app that a user sees and interacts with. It represents a Graphic User Interface
(GUI), representing one Android screen.

15: What are the four essential activity states?

The four states are:

 Active: The activity is at the top of the stack, running in the foreground
 Paused: The activity is still visible but cannot receive user input events; it’s in the background
 Stopped: The activity is invisible and consequently is paused, and obscured or hidden by a different
activity
 Destroyed: The activity’s process has been killed, completed, or terminated
16: What’s a content provider?

Content providers share information between different Android applications. They allow users to access data
within an application. Examples include contact information, images, video, and audio.

17: Explain Android Toast.

Toast, in this case, is a pop-up box (hence the word) giving feedback regarding an operation that the users
initiated, informing the user of the current status of said operation. For instance, when a smartphone user sends
a message to a friend, a toast is displayed saying “sending message”.

18: What’s the difference between mobile testing and mobile application testing?

Mobile Testing is performed on the mobile device itself, specifically on the device’s features like Contacts,
SMS, the browsers, and it’s Calling function. Mobile Application Testing tests the features and functions of the
apps loaded onto a mobile device.

19: What’s a “bundle” in Android?

Bundles are used to pass the required data to sub-folders.

20: How do you identify view elements in an android program?

Use the keyword findViewById.

21: Does Android have any drawbacks?

Android’s weaknesses stem from one of its advantages, namely that it’s everywhere and can run on a huge
number of devices.

 First of all, developers can encounter difficulty in creating apps that easily adjust the display to
accommodate the widely disparate screen sizes of all these different devices.
 Secondly, the large number of devices has given rise to a large number of custom-made Android
versions to suit them, thus there is no central set of policies governing upgrades, or parameters for
running on many operating systems. It’s anarchy out there!

22: Can Bytecode that is written in Java run on Android?

No, it cannot.

23: What is AAPT?

This is an acronym for Android Asset Packaging Tool. The tool gives developers the ability to deal with zip-
compatible archives, including content viewing, creation, and extraction.

24: What is ADB?

This acronym stands for Android Debug Bridge (a tool found in SDK). It’s a command-line tool used to
communicate between the emulator instances.
25: What does APK mean?

It’s short for Android Packaging Kit. Every file in the Android packaging key is compressed into a single file,
the APK.

26: Explain ANR.

This is an acronym for Application Not Responding, a pop-up or notification that kicks in when the application
is experiencing lag time for the user due to too many functions being performed simultaneously.

27: How do you place layouts in Android? Where are they placed?

They’re placed as XML files, in the layout folder.

28: Give some examples of Android exceptions.

Exceptions include:

 Inflate Exception
 Surface.OutOfResourceException
 SurfaceHolder.BadSurfaceTypeException
 WindowManager.BadTokenException

29: What are the four essential items in every Android project?

The four essential items are:

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

30: List the four Android supported dialogue boxes.

The four dialogue boxes are:

 Alert Dialog: Features selectable elements such as radio buttons and/or checkboxes
 Progress Dialog: Shows progress, either via a progress wheel or bar
 Date Picker Dialog: Lets the user select a date
 Time picker Dialog: Lets the user select a time

31: An Android application keeps crashing. How do you resolve the issue?

When an application crashes often, these are the best ways to fix it -

1. It could be a memory space issue. Make sure there’s enough memory space.
2. Clear the app data by clearing the cache memory using “settings” under Application Manager.
3. Not all apps run the same on assorted machines, so you may have to tinker with memory management.
4. It may be a matter of compatibility; a problem that can be headed off by testing the app on as many of
your devices as possible beforehand.

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, which 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:

-string
-charSequence
-List
-Map
-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.
Base

 Why does an Android App lag? - Learn from here


 What is Context? How is it used? - Context In Android Application
 Tell all the Android application components. - Learn from here
 What is the project structure of an Android Application? - Learn from here
 What is AndroidManifest.xml?
 What is Application class?
o The Application class in Android is the base class within an Android app that contains all other
components such as activities and services. The Application class, or any subclass of the Application
class, is instantiated before any other class when the process for your application/package is created.

Activity and Fragment

 Why is it recommended to use only the default constructor to create a Fragment? - Learn from here
 What is Activity and its lifecycle?
 What is the difference between onCreate() and onStart()
 When only onDestroy is called for an activity without onPause() and onStop()? - Learn from here
 Why do we need to call setContentView() in onCreate() of Activity class? - Learn from here
 What is onSavedInstanceState() and onRestoreInstanceState() in activity?
o onSavedInstanceState() - This method is used to store data before pausing the activity.
o onRestoreInstanceState() - This method is used to recover the saved state of an activity when the
activity is recreated after destruction. So, the onRestoreInstanceState() receive the bundle that contains
the instance state information.
 What is Fragment and its lifecycle.
 What are "launchMode"? - Learn from here and singleTask launchMode in Android
 What is the difference between a Fragment and an Activity? Explain the relationship between the
two. - Learn from here
 When should you use a Fragment rather than an Activity?
o When you have some UI components to be used across various activities
o When multiple view can be displayed side by side just like viewPager
 What is the difference between FragmentPagerAdapter vs FragmentStatePagerAdapter?
o FragmentPagerAdapter: Each fragment visited by the user will be stored in the memory but the view will
be destroyed. When the page is revisited, then the view will be created not the instance of the
fragment.
o FragmentStatePagerAdapter: Here, the fragment instance will be destroyed when it is not visible to the
user, except the saved state of the fragment.
 What is the difference between adding/replacing fragment in backstack? - Learn from here
 How would you communicate between two Fragments?
 What is retained Fragment?
o By default, Fragments are destroyed and recreated along with their parent Activity’s when a
configuration change occurs. Calling setRetainInstance(true) allows us to bypass this destroy-and-
recreate cycle, signaling the system to retain the current instance of the fragment when the activity is
recreated.
 What is the purpose of addToBackStack() while commiting fragment transaction?
o By calling addToBackStack(), the replace transaction is saved to the back stack so the user can reverse
the transaction and bring back the previous fragment by pressing the Back button. For more Learn from
here

Views and ViewGroups

 What is View in Android?


 Difference between View.GONE and View.INVISIBLE? - Learn from here
 Can you a create custom view? How?
 What are ViewGroups and how they are different from the Views?
o View: View objects are the basic building blocks of User Interface(UI) elements in Android. View is a
simple rectangle box which responds to the user’s actions. Examples are EditText, Button, CheckBox etc.
View refers to the android.view.View class, which is the base class of all UI classes.
o ViewGroup: ViewGroup is the invisible container. It holds View and ViewGroup. For example,
LinearLayout is the ViewGroup that contains Button(View), and other Layouts also. ViewGroup is the
base class for Layouts.
 What is a Canvas?
 What is a SurfaceView? - Learn from here
 Relative Layout vs Linear Layout.
 Tell about Constraint Layout
 Do you know what is the view tree? How can you optimize its depth? - Learn from here
 How does the Touch Control and Events work in Android?

Displaying Lists of Content

 What is the difference between ListView and RecyclerView? - Learn from here
 How does RecyclerView work internally?
 What is the ViewHolder pattern? Why should we use it? - Learn from here
 RecyclerView Optimization - Scrolling Performance Improvement - Learn from here
 Optimizing Nested RecyclerView - Learn from here
 What is SnapHelper? - Learn from here: SnapHelper

Dialogs and Toasts

 What is Dialog in Android? - Learn from here


 What is Toast in Android? - Learn from here
 What the difference between Dialog and Dialog Fragment? - Learn from here

Intents and Broadcasting

 What is Intent?
 What is an Implicit Intent?
 What is an Explicit Intent?
 What is a BroadcastReceiver? - Learn from here
 What is a LocalBroadcastManager?
 What is the function of an IntentFilter? - Learn from here
 What is a Sticky Intent?
o Sticky Intents allows communication between a function and a service. sendStickyBroadcast() performs
a sendBroadcast(Intent) known as sticky, i.e. the Intent you are sending stays around after the broadcast
is complete, so that others can quickly retrieve that data through the return value of
registerReceiver(BroadcastReceiver, IntentFilter). For example, if you take an intent for
ACTION_BATTERY_CHANGED to get battery change events: 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.
 Describe how broadcasts and intents work to be able to pass messages around your app? - Learn
from here
 What is a PendingIntent?
o If you want someone to perform any Intent operation at future point of time on behalf of you, then we
will use Pending Intent.
 What are the different types of Broadcasts? - Learn from here

Services

 What is Service? - Learn from here


 Service vs IntentService.
 What is a JobScheduler? - Learn from here

Inter-process Communication

 How can two distinct Android apps interact? - Learn from here
 Is it possible to run an Android app in multiple processes? How? - Learn from here
 What is AIDL? Enumerate the steps in creating a bounded service through AIDL. - Learn from
here
 What can you use for background processing in Android? - Learn from here
 What is a ContentProvider and what is it typically used for? - Learn from here and here

Long-running Operations

 How to run parallel tasks in Java or Android, and get callback when all complete? - Long-running
tasks in parallel with Kotlin Flow
 Why should you avoid to run non-ui code on the main thread? - Learn from here
 What is ANR? How can the ANR be prevented? - Learn from here
 What is an AsyncTask(Deprecated in API level 30) ?
 What are the problems in AsyncTask?
 When would you use java thread instead of an AsyncTask? - Learn from here
 What is a Loader? (Deprecated) - Learn from here
 What is the relationship between the life cycle of an AsyncTask and an Activity? What problems
can this result in? How can these problems be avoided?
o An AsyncTask is not tied to the life cycle of the Activity that contains it. So, for example, if you
start an AsyncTask inside an Activity and the user rotates the device, the Activity will be
destroyed (and a new Activity instance will be created) but the AsyncTask will not die but
instead goes on living until it completes.
o Then, when the AsyncTask does complete, rather than updating the UI of the new Activity, it
updates the former instance of the Activity (i.e., the one in which it was created but that is not
displayed anymore!). This can lead to an Exception (of the type
java.lang.IllegalArgumentException: View not attached to window manager if you use, for
instance, findViewById to retrieve a view inside the Activity).
o There’s also the potential for this to result in a memory leak since the AsyncTask maintains a
reference to the Activity, which prevents the Activity from being garbage collected as long as the
AsyncTask remains alive.
o For these reasons, using AsyncTasks for long-running background tasks is generally a bad idea .
Rather, for long-running background tasks, a different mechanism (such as a service) should be
employed.
o Note: AsyncTasks by default run on a single thread using a serial executor, meaning it has only 1
thread and each task runs one after the other.
 Explain Looper, Handler and HandlerThread.
 Android Memory Leak and Garbage Collection

Working With Multimedia Content

 How do you handle bitmaps in Android as it takes too much memory? - Learn from here and here
 What is the difference between a regular Bitmap and a nine-patch image?
o 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.
 Tell about the Bitmap pool. - Learn from here
 How image compression is preformed?

Data Saving

 How to persist data in an Android app?


 What is ORM? How does it work?
 How would you preserve Activity state during a screen rotation? - Learn from here
 What are different ways to store data in your Android app?
 Explain Scoped Storage in Android.
 How to encrypt data in Android?
 What is commit() and apply() in SharedPreferences?
o commit() returns a boolean value of success or failure immediately by writing data synchronously.
o apply() is asynchronous and it won't return any boolean response. If you have an apply() outstanding
and you are performing commit(), then the commit() will be blocked until the apply() is not completed.

Look and Feel

 What is a Spannable?
 What is a SpannableString?
o A SpannableString has immutable text, but its span information is mutable. Use a SpannableString when
your text doesn't need to be changed but the styling does. Spans are ranges over the text that include
styling information like color, heighliting, italics, links, etc
 What are the best practices for using text in Android?
 How to implement Dark mode in any application?
 How to generate dynamic colors based in image?
 Explain about Density Independence Pixel

Memory Optimizations

 What is the onTrimMemory() method? - Learn from here


 How does the OutOfMemory happens?
 How do you find memory leaks in Android applications?

Battery Life Optimizations

 How to reduce battery usage in an android application?


 What is Doze? What about App Standby? - Learn from here
 What is overdraw? - Learn from here

Supporting Different Screen Sizes

 How do you support different types of resolutions? - Learn from here

Permissions

 What are the different protection levels in permission?

Native Programming

 What is the NDK and why is it useful? - Learn from here: Android NDK and RenderScript
 What is renderscript? - Learn from here: Android NDK and RenderScript

Android System Internal

 What is Android Runtime? - Android Runtime


 Dalvik, ART, JIT, and AOT in Android - Dalvik, ART, JIT, and AOT
 What are the differences between Dalvik and ART? - Difference between Dalvik and ART
 What is DEX? - Learn from here
 Can you manually call the Garbage collector? - Is it possible to force Garbage Collection in Android?

Android Jetpack

 What is Android Jetpack and why to use this?


 What is a ViewModel and how is it useful? Learn: What is a ViewModel and how is it useful?
 What are Android Architecture Components?
 What is LiveData in Android?
 How LiveData is different from ObservableField?
 What is the difference between setValue and postValue in LiveData?
 How to share ViewModel between Fragments in Android?
 Explain Work Manager in Android.
 Use-cases of WorkManager in Android.
 How ViewModel work internally?

Others

 Why Bundle class is used for data passing and why cannot we use simple Map data structure? -
Learn from here
 How do you troubleshoot a crashing application? - Learn from here
 Explain Android notification system? Learn from here: How does the Android notification system
work?
 What is the difference between Serializable and Parcelable? Which is the best approach in
Android?
 What is AAPT? - Learn from here
 What is the best way to update the screen periodically? - Learn from here
 FlatBuffers vs JSON.
 HashMap, ArrayMap and SparseArray
 What are Annotations?
 How to create custom Annotation?
 How to handle multi-touch in android?
 What is the support library? Why was it introduced?
 What is Android Data Binding?
 How to check if Software keyboard is visible or not?
 How to take screenshot in Android programmatically?

Android Libraries

Android Interview Questions:

 Explain OkHttp Interceptor - Learn from here


 OkHttp - HTTP Caching - Learn from here
 Tell me something about RxJava.
 How will you handle error in RxJava?
 FlatMap Vs Map Operator - Learn from here
 When to use Create operator and when to use fromCallable operator of RxJava? - Learn from
here: RxJava Create and fromCallable Operator
 When to use defer operator of RxJava? - Learn from here: RxJava Defer Operator
 How are Timer, Delay, and Interval operators used in RxJava? - Learn from here
 How to make two network calls in parallel using RxJava? - RxJava Zip Operator
 Tell the difference between Concat and Merge. - Learn from here and here
 Explain Subject in RxJava? - Learn from here
 What are the types of Observables in RxJava? - Learn from here: Types Of Observables In RxJava
 How to implement search feature using RxJava in your application? - Learn from here: Instant
Search Using RxJava Operators
 Pagination In RecyclerView Using RxJava Operators - Learn from here
 How The Android Image Loading Library Glide and Fresco Works? - Learn from here, here and
here
 Difference between Schedulers.io() and Schedulers.computation() in RxJava.
 Why do we use the Dependency Injection Framework like Dagger in Android?
 How does the Dagger work?
 What is Component in Dagger?
 What is Module in Dagger?
 How does the custom scope work in Dagger?
 When to call dispose and clear on CompositeDisposable in RxJava? - Learn from here
 What is Multipart Request in Networking?
 What is Flow in Kotlin? - Learn from here

Android Architecture

Android Interview Questions:

 Describe the architecture of your last app.


 Describe MVP.
 Describe MVVM. - MVVM Architecture
 MVC vs MVP vs MVVM architecture.
 What is presenter?
 What is model?
 Describe MVC.
 Describe MVI
 Describe the repository pattern
 What is controller?
 Tell something about clean code

Android Design Problem

Android Interview Questions:

 Design Uber App. - Learn from here


 Design Facebook App.
 Design Facebook Near-By Friends App.
 Design WhatsApp.
 Design SnapChat.
 Design problems based on location based app.
 How to build offline-first app? Explain the architecture.
 Design LRU Cache.
 Design File Downloader - Learn from here
 Design an Image Loading Library - Learn from here, here and here
 HTTP Request vs HTTP Long-Polling vs WebSockets - Learn from blog and Video - HTTP Request
vs HTTP Long-Polling vs WebSocket vs Server-Sent Events
 How do Voice And Video Call Work? - Learn from here

Android Unit Testing

Android Interview Questions:

 What is Espresso? - Learn from here


 What is Robolectric? - Learn from here
 What are the disadvantages of using Robolectric? - Learn from here
 What is UI-Automator? - Learn from here
 Explain unit test. - Learn from here
 Explain instrumented test. - Learn from here
 Have you done unit testing or automatic testing?
 Why Mockito is used? - Learn from here
 Describe JUnit test. - Learn from here
 Describe code coverage.

Android Tools And Technologies

Android Interview Questions:

 What is ADB? - Learn from here


 What is DDMS and what can you do with it? - Learn from here
 What is the StrictMode? - Learn from here: StrictMode
 What is Lint? What is it used for?
 Git.
 Android Development Useful Tools.
 Firebase. - Learn from here
 How to measure method execution time in Android?
 Can you access your database of SQLite Database for debugging? - Learn from here
 What are things that we need to take care while using Proguard?
 What is Multidex in Android?
 How to use Android Studio Memory Profiler?
 How to use Firebase realtime database in your app?
 What is Gradle?
 APK Size Reduction.
 How can you speed up the Gradle build?
 About gradle build system.
 About multiple apk for android application.
 What is proguard used for?
 What is obfuscation? What is it used for? What about minification?
 How to change some parameters in an app without app update?

Java and Kotlin

Android Interview Questions:

OOP

 Explain OOP Concepts.


o Object-Oriented Programming is a methodology of designing a program using classes, objects,
inheritance, polymorphism, abstraction, and encapsulation.
 What is the difference between a constructor and a method?
o The name of the constructor is same as that of the class name, whereas the name of the method
can be anything.
o There is no return type of a constructor.
o When you make an object of a class, then the constructor of that class will be called
automatically. But for methods, we need to call it explicitely.
o Constructors can't be inherited but you can call the constructor of the parent class by calling
super().
o Constructor and a method they both run a block of code but the difference is in calling them.
o We can call method directly using their name.
o Constructor Syntax -
o public class SomeClassName{
o SomeClassName(parameter_list){
o ...
o }
o ...
}

o Note: In the above syntax, the name of the constructor is the same as that of class and it has no
return type.
o Method Syntax
o public class SomeClassName{
o public void someMethodName(parameter_list){
o ...
o }
o // call method
o someMethodName(parameter_list)
}

 Differences between abstract classes and interfaces?


o An abstract class, is a class that contains both concrete and abstract methods (methods without
implementations). An abstract method must be implemented by the abstract class sub-classes. Abstract
classes cannot be instantiated and need to be extended to be used.
o An interface is like a blueprint/contract of a class (or it may be thought of as a class with methods, but
without their implementation). It contains empty methods that represent, what all of its subclasses
should have in common. The subclasses provide the implementation for each of these methods.
Interfaces are implemented.
 What is the difference between iterator and enumeration in java?
o In Enumeration we don't have remove() method and we can only read and traverse through a collection.
o Iterators can be applied to any collection. In Iterator, we can read and remove items from a collection.
 Do you agree we use composition over inheritance?
 Difference between method overloading and overriding.

o Overloading happens at compile-time while Overriding happens at runtime: The binding of


overloaded method call to its definition happens at compile-time however binding of overridden
method call to its definition happens at runtime. More info on static vs. dynamic binding:
StackOverflow.
o Static methods can be overloaded which means a class can have more than one static method of
same name. Static methods cannot be overridden, even if you declare a same static method in
child class it has nothing to do with the same method of parent class as overridden static methods
are chosen by the reference class and not by the class of the object.

So, for example:


public class Animal {
public static void testClassMethod() {
System.out.println("The static method in Animal");
}

public void testInstanceMethod() {


System.out.println("The instance method in Animal");
}
}

public class Cat extends Animal {


public static void testClassMethod() {
System.out.println("The static method in Cat");
}

public void testInstanceMethod() {


System.out.println("The instance method in Cat");
}

public static void main(String[] args) {


Cat myCat = new Cat();
myCat.testClassMethod();
Animal myAnimal = myCat;
myAnimal.testClassMethod();
myAnimal.testInstanceMethod();
}
}

Will output:

The static method in Cat // testClassMethod() is called from "Cat"


reference

The static method in Animal // testClassMethod() is called from "Animal"


reference,
// ignoring actual object inside it (Cat)

The instance method in Cat // testInstanceMethod() is called from "Animal"


reference,
// but from "Cat" object underneath

The most basic difference is that overloading is being done in the same class while for overriding
base and child classes are required. Overriding is all about giving a specific implementation to
the inherited method of parent class.

Static binding is being used for overloaded methods and dynamic binding is being used for
overridden/overriding methods. Performance: Overloading gives better performance compared to
overriding. The reason is that the binding of overridden methods is being done at runtime.

Private and final methods can be overloaded but they cannot be overridden. It means a class can
have more than one private/final methods of same name but a child class cannot override the
private/final methods of their base class.

Return type of method does not matter in case of method overloading, it can be same or
different. However in case of method overriding the overriding method can have more specific
return type (meaning if, for example, base method returns an instance of Number class, all
overriding methods can return any class that is extended from Number, but not a class that is
higher in the hierarchy, like, for example, Object is in this particular case).
Argument list should be different while doing method overloading. Argument list should be
same in method Overriding. It is also a good practice to annotate overridden methods with
@Override to make the compiler be able to notify you if child is, indeed, overriding parent's
class method during compile-time.

 What are the access modifiers you know? What does each one do?
o There are four access modifiers in Java language (from strictest to the most lenient):
1. private variables, methods, constructors or inner classes are only visible to its' containing class
and its' methods. This modifier is most commonly used, for example, to allow variable access
only through getters and setters or to hide underlying implementation of classes that should not
be used by user and therefore maintain encapsulation. Singleton constructor is also marked
private to avoid unwanted instantiation from outside.
2. Default (no keyword is used) this modifier can be applied to classes, variables, constructors
and methods and allows access from classes and methods inside the same package.
3. protected can be used on variables, methods and constructors therefore allowing access only
to subclasses and classes that are inside the same package as protected members' class.
4. public modifier is widely-used on classes, variables, constructors and methods to grant access
from any class and method anywhere. It should not be used everywhere as it implies that data
marked with public is not sensitive and can not be used to harm the program.
 Can an Interface implement another Interface?
o Yes, an interface can implement another interface (and more than one), but it needs to use extends,
rather than implements keyword. And while you can not remove methods from parent interface, you
can add new ones freely to your sub-interface.
 What is Polymorphism? What about Inheritance?
o Polymorphism in Java has two types: Compile time polymorphism (static binding) and Runtime
polymorphism (dynamic binding). Method overloading is an example of static polymorphism,
while method overriding is an example of dynamic polymorphism.

An important example of polymorphism is how a parent class refers to a child class object. In
fact, any object that satisfies more than one IS-A relationship is polymorphic in nature.

For instance, let’s consider a class Animal and let Cat be a subclass of Animal. So, any cat IS
animal. Here, Cat satisfies the IS-A relationship for its own type as well as its super class
Animal.

o Inheritance can be defined as the process where one class acquires the properties (methods and
fields) of another. With the use of inheritance the information is made manageable in a
hierarchical order.

The class which inherits the properties of other is known as subclass (derived class, child class)
and the class whose properties are inherited is known as superclass (base class, parent class).

Inheritance uses the keyword extends to inherit the properties of a class. Following is the syntax
of extends keyword.

class Super {
.....
.....
}
class Sub extends Super {
.....
.....
}
 Multiple inheritance in Classes and Interfaces in java
 What are the design patterns?
o Creational patterns
 Builder Wikipedia
 Factory Wikipedia
 Singleton Wikipedia
 Monostate Wikipedia
 Fluent Interface Pattern Wikipedia
Structural patterns
 Adapter Wikipedia
 Decorator Wikipedia
 Facade Wikipedia
Behavioural patterns
 Chain of responsibility Wikipedia
 Iterator Wikipedia
 Strategy Wikipedia

Collections and Generics

 Arrays Vs ArrayLists - Learn from here


 HashSet Vs TreeSet - Learn from here
 HashMap Vs Set - Learn from here
 Stack Vs Queue
 Explain Generics in Java?
o Generics were included in Java language to provide stronger type checks, by allowing the
programmer to define, which classes can be used with other classes

In a nutshell, generics enable types (classes and interfaces) to be parameters when defining
classes, interfaces and methods. Much like the more familiar formal parameters used in method
declarations, type parameters provide a way for you to re-use the same code with different
inputs. The difference is that the inputs to formal parameters are values, while the inputs to type
parameters are types. (Official Java Documentation)

o This means that, for example, you can define:

List<Integer> list = new ArrayList<>();

And let the compiler take care of noticing, if you put some object, of type other than Integer
into this list and warn you.

o It should be noted that standard class hierarchy does not apply to generic types. It means that
Integer in List<Integer> is not inherited from <Number> - it is actually inherited directly from
<Object>. You can still put some constraints on what classes can be passed as a parameter into a
generic by using wildcards like <?>, <? extends MyCustomClass> or <? super Number>.
o While generics are very useful, late inclusion into Java language has put some restraints on their
implementation - backward compatibility required them to remain just "syntactic sugar" - they
are erased (type erasure) during compile-time and replaced with object class.
 What is Java PriorityQueue? - In Priority Queue, each element is having some priority and all the
elements are present in a queue. The operations are performed based on the priority.
Objects and Primitives

 How is String class implemented? Why was it made immutable?


o There is no primitive variant of String class in Java language - all strings are just wrappers
around underlying array of characters, which is declared final. This means that, once a String
object is instantiated, it cannot be changed through normal tools of the language (Reflection still
can mess things up horribly, because in Java no object is truly immutable). This is why String
variables in classes are the first candidates to be used, when you want to override hashCode()
and equals() of your class - you can be sure, that all their required contracts will be satisfied.

Note: The String class is immutable, so that once it is created a String object cannot be changed.
The String class has a number of methods, some of which will be discussed below, that appear to
modify strings. Since strings are immutable, what these methods really do is create and return a
new string that contains the result of the operation. (Official Java Documentation)

This class is also unique in a sense, that, when you create an instance like this:

String helloWorld = "Hello, World!";

"Hello, World!" is called a literal and compiler creates a String object with its' value. So

String capital = "Hello, World!".toUpperCase();

is a valid statement, that, firstly, will create an object with literal value "Hello, World!" and then
will create and return another object with value "HELLO, WORLD!"

o String was made immutable to prevent malicious manipulation of data, when, for example, user
login or other sensitive data is being send to a server.
 What does it means to say that a String is immutable?
o It means that once created, String object's char[] (its' containing value) is declared final and,
therefore, it can not be changed during runtime.
 What is String.intern()? When and why should it be used?
o String.intern() is used to mange memory in Java code. It is used when we have duplicates value in
different strings. When you call the String.intern(), then if in the String pool that string is present
then the equals() method will return true and it will return that string only.
 Can you list 8 primitive types in java?
o byte
o short
o int
o long
o float
o double
o char
o String
o boolean
 What is the difference between an Integer and int?
o int is a primitive data type (with boolean, byte, char, short, long, float and double), while
Integer (with Boolean, Byte, Character, Short,Long, Float and Double) is a wrapper class that
encapsulates primitive data type, while providing useful methods to perform different tasks with it.
 What is Autoboxing and Unboxing?
o Autoboxing and Unboxing is the process of automatic wrapping (putting in a box) and unwrapping
(getting the value out) of primitive data types, that have "wrapper" classes. So int and Integer can
(almost always) be used interchangeably in Java language, meaning a method void giveMeInt(int
i) { ... } can take int as well as Integer as a parameter.
 Typecast in Java
o In Java, you can use casts to polymorph one class into another, compatible one. For example:
o long i = 10l;
o int j = (int) i;
long k = j;

Here we see, that, while narrowing (long i -> int j) requires an explicit cast to make sure the
programmer realizes, that there may be some data or precision loss, widening (int j -> long k) does
not require an explicit cast, because there can be no data loss (long can take larger numbers than int
allows).

 Do objects get passed by reference or value in Java? Elaborate on that.


o In Java all primitives and objects are passed by value, meaning that their copy will be manipulated in the
receiving method. But there is a caveat - when you pass an object reference into a method, a copy of
this reference is made, so it still points to the same object. This means, that any changes that you make
to the insides of this object are retained, when the method exits.
o public class Pointer {
o
o int innerField;
o
o public Pointer(int a) {
o this.innerField = a;
o }
}
public class ValueAndReference {

public static void main(String[] args) {

Pointer a = new Pointer(0);


int b = 1;

print("Before:");
print("b = " + b);
print("a.innerField = " + a.innerField);
exampleMethod(a, b);
print("After:");
print("b = " + b);
print("a.innerField = " + a.innerField);
}

static void exampleMethod(Pointer a, int b) {


a.innerField = 2;
b = 10;
}

static void print(String text) {


System.out.println(text);
}
}

Will output:

Before:

b = 1

a.innerField = 0
After:

b = 1 // a new local int variable was created and operated on, so


"b" didn't change

a.innerField = 2 // Pointer a got its' innerField variable changed


// from 0 to 2, because method was operating on
// the same reference to an instance

 What is the difference between instantiation and initialization of an object?


 What the difference between local, instance and class variables?
o Local variables exist only in methods that created them, they are stored separately in their respected
Thread Stack (for more information, see question about Java Memory Model) and cannot have their
reference passed outside of the method scope. That also means that they cannot be assigned any access
modifier or made static - because they only exist during enclosing method's execution and those
modifiers just do not make sense, since no other outside method can get them anyway.
o Instance variables are the ones, that are declared in classes and their value can be different from one
instance of the class to another, but they always require that class' instance to exist.
o Class variables are those, that are marked with static keyword in their class' body. They can only have
one value across all instances of that class (changing it in one place will change it in their class and,
therefore, in all instances) and can even be retrieved without that class' instance (if their access modifier
allows it).

Java Memory Model and Garbage Collector

 What is garbage collector? How does it work?


o All objects are allocated on the heap area managed by the JVM. As long as an object is being referenced,
the JVM considers it alive. Once an object is no longer referenced and therefore is not reachable by the
application code, the garbage collector removes it and reclaims the unused memory.
 What is Java Memory Model? What contracts does it guarantee? How are its' Heap and Stack
organized?
 What is memory leak and how does Java handle it?
 What are strong, soft, weak and phantom references in Java?

Concurrency

 What does the keyword synchronized mean?


 What is a ThreadPoolExecutor? - ThreadPoolExecutor in Android
 What is volatile modifier?
 The classes in the atomic package expose a common set of methods: get, set,, lazyset,
compareAndSet, and weakCompareAndSet. Please describe them.

Exceptions

 How does the try{}, catch{}, finally works?


 What is the difference between a Checked Exception and an Un-Checked Exception?

Others

 What is serialization? How do you implement it?


o Serialization is the process of converting an object into a stream of bytes in order to store an object into
memory, so that it can be recreated at a later time, while still keeping the object's original state and
data. In Android you may use either the Serializable, Externalizable (implements Serializable) or
Parcelable interfaces.
o While Serializable is the easiest to implement, Externalizable may be used if you need to insert custom
logic into the process of serialization (although it is almost never used nowadays as it is considered a
relic from early versions of Java). But it is highly recommended to use Parcelable in Android instead, as
Parcelable was created exclusively for Android and it performs about 10x faster than Serializable,
because Serializable uses reflection, which is a slow process and tends to create a lot of temporary
objects and it may cause garbage collection to occur more often.
o To use Serializable all you have to do is implement the interface:
o // Implementing the Serializable interface is all that is required
o public class User implements Serializable {
o
o private String name;
o private String email;
o
o public User() {
o }
o
o public String getName() {
o return name;
o }
o
o public void setName(final String name) {
o this.name = name;
o }
o
o public String getEmail() {
o return email;
o }
o
o public void setEmail(final String email) {
o this.email = email;
o }
}

o Parcelable requires a bit more work:


o public class User implements Parcelable {
o
o private String name;
o private String email;
o
o /**
o * Interface that must be implemented and provided as a public
CREATOR field
o * that generates instances of your Parcelable class from a Parcel.
o */
o public static final Creator<User> CREATOR = new Creator<User>() {
o
o /**
o * Creates a new USer object from the Parcel. This is the reason
why
o * the constructor that takes a Parcel is needed.
o */
o @Override
o public User createFromParcel(Parcel in) {
o return new User(in);
o }
o
o /**
o * Create a new array of the Parcelable class.
o * @return an array of the Parcelable class,
o * with every entry initialized to null.
o */
o @Override
o public User[] newArray(int size) {
o return new User[size];
o }
o };
o
o public User() {
o }
o
o /**
o * Parcel overloaded constructor required for
o * Parcelable implementation used in the CREATOR
o */
o private User(Parcel in) {
o name = in.readString();
o email = in.readString();
o }
o
o public String getName() {
o return name;
o }
o
o public void setName(final String name) {
o this.name = name;
o }
o
o public String getEmail() {
o return email;
o }
o
o public void setEmail(final String email) {
o this.email = email;
o }
o
o @Override
o public int describeContents() {
o return 0;
o }
o
o /**
o * This is where the parcel is performed.
o */
o @Override
o public void writeToParcel(final Parcel parcel, final int i) {
o parcel.writeString(name);
o parcel.writeString(email);
o }
}

Note: For a full explanation of the describeContents() method see StackOverflow. In Android Studio, you
can have all of the parcelable code auto generated for you, but like with everything else, it is always a
good thing to try and understand everything that is happening.

 What is transient modifier?


 What are anonymous classes?
 What is the difference between using == and .equals on an object?
 What is the hashCode() and equals() used for?
 Why would you not call abstract method in constructor? - Learn from here
 When would you make an object value final?
 What are these final, finally and finalize keywords?
o final is a keyword in the java language. It is used to apply restrictions on class, method and variable.
Final class can't be inherited, final method can't be overridden and final variable value can't be changed.
o class FinalExample {
o public static void main(String[] args) {
o final int x=100;
o x=200;//Compile Time Error because x is final
o }
}

o finally is a code block and is used to place important code, it will be executed whether exception is
handled or not.
o class FinallyExample {
o public static void main(String[] args) {
o try {
o int x=300;
o }catch(Exception e) {
o System.out.println(e.getMessage()); }
o finally {
o System.out.println("finally block is executed");
o }
o }
}

o Finalize is a method used to perform clean up processing just before object is garbage collected.
o class FinalizeExample {
o public void finalize() {
o System.out.println("finalize called");
o }
o
o public static void main(String[] args) {
o FinalizeExample f1=new FinalizeExample();
o FinalizeExample f2=new FinalizeExample();
o f1=null;
o f2=null;
o System.gc();
o }
}

 What is the difference between "throw" and "throws" keyword in Java?


o throws is just used to indicated which exception is to be thrown. But the throw keyword is used to
throw some exception from any static block or any method.
 What does the static word mean in Java?
o In case of static variable it means that this variable (its' value or the object it references) spans across
all instances of enclosing class (changing it in one instance affects all others), while in case of static
methods it means that these methods can be invoked without an instance of their enclosing class. It is
useful, for example, when you create util classes that need not be instantiated every time you want to
use them.
 Can a static method be overridden in Java?
o While child class can override a static method with another static method with the same signature
(return type can be down-casted), it is not truly overridden - it becomes "hidden", but both methods can
still be accessed under right circumstances (see question about overloading/overriding above).
 When is a static block run?
o Code inside static block is executed only once: the first time you make an object of that class or the first
time you access a static member of that class (even if you never make an object of that class).
 What is reflection?
o You can inspect classes, interfaces, fields, and method at runtime with the help of reflection and the
best part is that you need not know the names of these classes, methods, etc.
 What is Dependency Injection?
 How is a StringBuilder implemented to avoid the immutable string allocation problem? - Learn
from here
 Difference between StringBuffer and StringBuilder?
 What is the difference between fail-fast and fail-safe iterators in Java?
o Fail-safe iterator will not throw any exception even if the collection is modified while iteration over it.
But in Fail-safe iterator, it throws a ConcurrentModificationException when you try to modify the
collection while using it.

You might also like