Android Development (55 Blogs) Become a Certified Professional

Top 50 Android Interview Questions You Must Prepare In 2023

Last updated on Nov 18,2022 67.7K Views

Aayushi Johari
A technophile who likes writing about different technologies and spreading knowledge. A technophile who likes writing about different technologies and spreading knowledge.
1 / 1 Blog from Android Interview Questions

Android Interview Questions

While both iOS and Android skills are in high demand, employers are hiring Android developers much faster and more often than any other professionals in mobile tech. In the fourth quarter of last year, Android retained its position as the largest mobile operating system worldwide, controlling the mobile OS industry with a nearly 71 percent share, while iOS accounted for approximately 28 percent of the mobile operating system market. With these numbers only expected to rise in the coming years, Android App Development Certification has emerged as one of the hottest skills in the market today!

The demand for Android developers is on a meteoric rise and the time is right to break into a career in Android development. To help you get started, we have compiled a list of frequently asked Android interview questions to help you ace the Android interviews that come your way. In case you have attended Android interviews yourself or have any questions that you want us to answer for you, do feel free to add them as comments below.

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

The most recent version, Android 13, was published on August 15, 2022, while the recently released Android 12.1/12L offers advancements for foldable phones, tablets, desktop-sized screens, and Chromebooks. Android is a mobile operating system developed by Google. It is based on the Linux kernel and designed primarily for touchscreen mobile devices such as smartphones and tablets. Every other Android version has been named after either sweet or desserts. The following table represents the Android name, version and the year of release.

Android NameVersionYear of Release
Android 1.5Android Cupcake2009
1.6Donut2009
2.0-2.1Eclair2009
2.2 – 2.2.3Froyo2010
2.3 – 2.3.7Gingerbread2010
3.0 – 3.2.6Honeycomb2011
4.0 – 4.0.4Ice Cream Sandwich2011
4.1 – 4.3.1Jelly Bean2012
4.4 – 4.4.4KitKat2013
5.0 – 5.1.1Lollipop2014
6.0 – 6.0.1Marshmallow2015
7.0 – 7.1.2Nougat2016
8.0 – 8.1Oreo2017
9.0Pie2018

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

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

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

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

  • onCreate(Bundle): It is a method where your initialization is done. Under this, you will callsetContentView(int) with a layout resource which defines your UI.  Also, you can retrieve the widgets in that UI by using findViewById(Int).  These are required to interact programmatically.
  • onPause(): It is a method which deals with the user whenever it leaves the activity. So any changes made by the user should be commited which is done by the ContentProvider that holds the data. 

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

public class MainActivity extends Activity {
}

Q3. What are the features of Android?

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

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

  • Android - Android Interview Questions - EdurekaOpen-source
  • Customizable operating System
  • Variety of apps can be developed.
  • Reduces overall complexity
  • Supports messaging services, web browser, storage(SQLite), connectivity,media and many more.

Q4. Explain Android Architecture.

Android architecture refers to the different layers in the Android stack. It includes your operating system, middleware, and important applications. Each layer in the architecture provides different services to the layer just above it. The four layers in the Android stack are:

  • Linux Kernel
  • Libraries
  • Android Framework
  • Android Applications

For more information about Android layers, Stack and their functions in the blog post – Android Tutorial.

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

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

Q6. What is APK format?

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

Q7. What is the life cycle of android activity?

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

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

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

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

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

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

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

ActivityLifeCycle - Android Interview Questions - Edureka

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

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

Methods are used to deliver intents to different components:

  • context.startActivity() – To start an activity
  • context.startService() – To start a service
  • context.sendBroadcast() – To deliver a broadcast

Types of Intent:

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

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

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

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


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

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

For example:

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

Q10. What is an Android Framework?

Android Framework is an essential part of the Android Architecture. It is a set of APIs that allows developers to write apps and has the following components:

ServicesComponents that conduct long-running operations in the background, without the inclusion of a user interface.
IntentObjects that initiate actions from other app components, either within your program (explicit intents) or through another piece of software on the device (implicit intents).
ActivitiesComponents that provide users with screens on which they can interact with objects and perform actions. This is the base from which Intents can be deployed.
Content ProvidersComponents that enable users to access data within an app such as audio, video, images, contact information, etc.
OthersApp widgets and Processes and Threads

Q11. What is the difference between File, Class, and Activity in android?

The difference between them are as follows:

  • File is a block of arbitrary information or resources for storing information. It can be any file type.
  • Class is a compiled from of .Java file which Android uses to produce an executable apk.
  • Activity is the equivalent of a Frame/Window in GUI toolkits. It is not a file or a file type but just a class that can be extended in Android to load UI elements on view.

Q12. What is Google Android SDK? What are the tools placed in android SDK?

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

  • Android Emulator
  • DDMS – Dalvik Debug Monitoring Services
  • AAPT – Android Asset Packaging tool
  • ADB – Android debug bridge

Q13. What is a Toast? Write its syntax.

  • Toast notification is a message that pops up on the window.
  • It only covers the expanse of space required for the message and the user’s recent activity remains visible and interactive.
  • The notification automatically fades in and out and does not accept interaction events.

Syntax:

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

Q14. What is an Android Framework?

Android Framework is an essential part of the Android Architecture. It is a set of APIs that allows developers to write apps and has the following components:

Q15. What is an ANR? What are some measures you can take to avoid ANR?

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

  • When there is no response to an input event after 5 seconds.
  • When a broadcast receiver is not done executing within 10 seconds.

 Following measures can be taken to avoid ANR:

  • To avoid ANR, an app should perform a lengthy database or networking operations in separate threads.
  • One technique is to create a child thread to prevent the Android system from concluding a code that has been unresponsive for a long period of time. Most of the actual workings of the codes can be placed within the child thread to ensure that the main thread runs with minimal unresponsive time.
  • For background task-intensive apps, you can alleviate pressure from the UI thread by using the IntentService.

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

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

  • Broadcast Receiver is a mechanism using which host application can listen for System level events.
  • Broadcast receiver is used by the application whenever they need to perform the execution based on system events. Like listening for Incoming call, sms etc.
  • Broadcast receivers helps in responding to broadcast messages from other application or from the system.
  • It is used to handle communication between Android operating system and applications. 

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

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

Q17. How will you pass data to sub-activities?

  • We can use Bundles to pass data to sub-activities.
  • There are like HashMaps that and take trivial data types. These Bundles transport information from one Activity to another
Bundle b=new Bundle();
b.putString("Email","[email protected]");
i.putExtras(b); // where I is intent

Q18. What is the use of WebView in Android?

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

Q19. What are the different kinds of context in Android?

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

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

  • App – It describes the fundamental characteristics of the app and defines each of its components.
  • javaThis contains the .java source files for your project. By default, it includes an MainActivity.java source file. Under this, you create all the activities which have .java extensions and all the code behind the application. MainActivity.java is the actual file which gets converted to a dalvik executable and runs your app.
  • res – It is a directory for files that define your app’s user interface. You can add TextView, button etc to build the GUI and use its various attributes like android:layout_widthandroid:layout_height etc which are used to set its width and height. 
  • Gradle Scripts – This is an auto-generated file which contains compileSdkVersion, buildToolsVersion, applicationId, minSdkVersion, targetSdkVersion, versionCode and versionName

components- android interview questions - edurekaQ21. What are the different storage methods in Android?

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

  • Shared Preferences – Store private primitive data in key-value pairs
  • Internal Storage – Store private data on the device memory
  • External Storage – Store public data on the shared external storage
  • SQLite Databases – Store structured data in a private database

Q22. Can you deploy executable JARs on android? Which package is supported by it?

No, Android does not support JAR deployments. Applications are packed into Android Package(.apk) using Android Asset Packaging Tool (APT) and then deployed on to the Android platform.

Q23. What is a Service? How is it implemented?

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

  1. Local: This service is accessed from within the application.
  2. Remote – This service is accessed remotely from other applications running on the same device.

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

public class MyService extends Service {
}

Q24. What is a Sticky Intent?

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

Q25. Explain Folder, File & Description of Android Apps

  • src: contains the .java source files for your project.
  • gen: contains the .R file, a compiler-generated file that references all the resources found in your project.
  • bin: contains the Android package files .apk built by the ADT during the build process and everything else needed to run an Android application.
  • res/drawable-hdpi: this is a directory for drawable objects that are designed for high-density screens.
  • res/layout: this is a directory for files that define your app’s user interface.
  • res/values: this is a directory for other various XML files that contain a collection of resources, such as strings and colors definitions.
  • AndroidManifest.xml: this is the manifest file which describes the fundamental characteristics of the app and defines each of its components.

Q26. How does Manifest file plays an integral role in App development?

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

  • It names the Java package for the app as the package name serves as a unique identifier for the application.
  • It protects the application by declaring permissions in order to access protected parts of the API and interact with other applications.
  • Manifest file declares the minimum level of the android API and list the libraries which is linked with the application.
  • Manifest file list the instrumentation classes.  These classes provide profiling and other information as the application runs, but this information is removed as soon the application is publishes. It remains only till the application is in development mode.

Structure of a manifest file: The structure of a manifest file consists of various elements such as action, activity, activity-alias and many more. Refer to the below screenshot which shows the general structure of the manifest file.

&lt;?xml version="1.0" encoding="utf-8"?&gt;
cmanifest xmlns:android="&lt;a class="Xx" rel="nofollow noreferrer noopener" href="https://www.google.com/url?q=http://schemas.android.com/apk/res/android&amp;sa=D&amp;source=hangouts&amp;ust=1556291767429000&amp;usg=AFQjCNH7OW4Zi9NULaQDs71WDEo-67ZouA" target="_blank" tabindex="-1" data-display="http://schemas.android.com/apk/res/android" data-sanitized="https://www.google.com/url?q=http://schemas.android.com/apk/res/android&amp;sa=D&amp;source=hangouts&amp;ust=1556291767429000&amp;usg=AFQjCNH7OW4Zi9NULaQDs71WDEo-67ZouA"&gt;http://schemas.android.com/apk/res/android"
package="com.example.aayushi.myapplication"&gt;
&lt;application android:allowBackup-"true" android:icon="@mipmap/ic_launcher android:label="My Application android: roundIcon="@mipmap/ic launcher round" android:supportsRtl="true android:theme="style/AppTheme"&gt;
&lt;activity android:name=".MainActivity"&gt;
  &lt;intent-filter&gt;
    &lt;action android:name="android.intent.action.MAIN &gt;
    &lt;category android:name="android.intent.category. LAUNCHER" /&gt;
   &lt;/intent-filter&gt;
  &lt;/activity&gt;
 &lt;/applications
&lt;/manifest&gt;

Q27. What is the difference between a fragment and an activity?

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

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

Q28. Can you change the name of an application after its deployment?

It is not recommended to change the application after its deployment. This may break some functionality.

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

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

Q30. What is DDMS?

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

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

Q31. What is the difference between Service and Thread?

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

Q32. What are the containers?

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

Q33. What are some of the disadvantages of Android?

Android being an open-source platform, and considering 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. An app that runs on one version of Android OS may or may not run on another version.

Another disadvantage is that it can be challenging for developers to create apps that can adjust correctly to the right screen size and other varying features and specs of various Android devices.

Q34. What is an Android Runtime?

  • Android Runtime consists of Dalvik Virtual machine and Core Java libraries.
  • DVM is optimized for low processing power and low memory environments.
  • Unlike JVM, the Dalvik Virtual Machine doesn’t run .class files, instead it runs .dex files.
  • Android 2.2 “Froyo“ brought trace-based just-in-time (JIT) compilation into Dalvik, optimizing the execution of applications and dynamically compiling frequently executed short segments of their bytecode into native machine code.

Android Runtime - Android Interview Questions - Edureka

Q35. What is the importance of an emulator in Android?

  • The emulator lets you play around an interface that acts as if it were an actual device.
  • It let you write and test codes, and even debug.
  • It acts as a safe place for testing codes especially if its in the early design phase.

Q36. Name the four essential states of an activity.

The four essential states of activity are:

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

Q37. What is the difference between a regular bitmap and a nine-patch image?

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

Q38. What are the core building blocks of android?

  • Activity : An Activity is the screen representation of any application in Android.  Each activity has a layout file where you can place your UI.
  • Content Provider: Content providers share data between applications.
  • Service: It is a component that runs in the background to perform long-running operations without interacting with the user and it even works if application is destroyed.
  • Broadcast Receivers: It respond to broadcast messages from other applications or from the system itself. These messages are sometime called events or intents.

Q39. What are the dialog boxes that are supported in Android?

Android supports four dialog boxes:

  • AlertDialog: An alert dialog box supports zero to three buttons and a list of selectable elements, including checkboxes and radio buttons. Among the other dialog boxes, the most suggested dialog box is the alert dialog box.
  • ProgressDialog: This dialog box displays a progress wheel or a progress bar. It is an extension of AlertDialog and supports adding buttons.
  • DatePickerDialog: This dialog box is used for selecting a date by the user.
  • TimePickerDialog: This dialog box is used for selecting time by the user.

Q40. What does APK stand for? 

APK stands for Android Packaging Kit. The Android packaging key is compressed with classes, UI’s, supportive assets and manifest. All these files are compressed to a single file which is called APK.

Q41. What is a sticky broadcast? Give an example.

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

Q42. What is Dalvik Virtual Machine (DVM)?

  • Dalvik is the name of Android’s virtual machine.
  • The Dalvik VM is an interpreter-only virtual machine that executes files in the Dalvik Executable (.dex) format.
  • The virtual machine is register-based and can run classes compiled by Java language compiler that have been altered into its native format using the included ‘dx’ tool.
  • The Dalvik core class library is envisioned to provide a familiar development base for those used to programming with Java Standard Edition, but is geared explicitly for the needs of a small mobile device.

Q43. What are the exceptions in android?

  • InflateException: When error conditions occur this exception is thrown.
  • Surface.OutOfResourceException: When a Surface is not created or resized, this exception is thrown.
  • SurfaceHolder.BadSurfaceTypeException: When invoked on a Surface ‘SURFACE_TYPE_PUSH_BUFFERS’, this exception is thrown from lockCanvas() method.
  • WindowManager.BadTokenException: This exception is thrown at the time of trying to view an invalid WindowManager.LayoutParamstoken

Q44. What is a content provider? How is it implemented?

  • Content providers manage access to a structured set of data. It is the standard interface that connects data in one process with code running in another process.
  • They encapsulate the data and provide mechanisms for defining data security.
  • Content providers are used to share the data between different applications.

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

public class MyContentprovider extends ContentProvider {
 public void onCreate(){}
 }

Q45. What is the significance of the .dex files?

  • Android programs are compiled into ‘.dex’ (Dalvik Executable) files, which are zipped into a single .apk file on the device.
  • ‘.dex’ files can be created by translating compiled applications written in Java.
  • (.dex) is a format that is optimized for effective storage and memory-mappable executions. 

Q46. How are escape characters used as attribute?

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

Q47. What does ADB stand for?

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

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

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

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

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

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

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

Q49. What is Orientation in android? How is it done?

Orientation helps to represent the layout in a row or column. 

Syntax:

&lt;activity android name=".activity" android: screenOrientation="portrait"&gt;

Q50. What is AIDL? What are the datatypes supported by AIDL ?

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

Data Types:

  • String
  • List
  • Map
  • CharSequence
  • Native Java data types (int, long, char and Boolean)

So this brings us to the end of the Android interview questions blog. The topics that you learnt in this Android Interview Questions article are the most sought-after skill sets that recruiters look for in an Android developer. These set of Android Interview Questions will definitely help you ace your job interview. Good luck with your interview!

In case you are facing any challenges with these Android interview questions, please comment your problems in the section below. Apart from this Android Interview Questions, if you want to get trained from professionals on this technology, you can opt for a structured training from edureka

Got a question for us? Please mention it in the comments section of “Android Interview Questions” and we will get back to you.

 

Upcoming Batches For Android Certification Training Course
Course NameDate
Android Certification Training Course

Class Starts on 4th March,2023

4th March

SAT&SUN (Weekend Batch)
View Details
Android Certification Training Course

Class Starts on 6th May,2023

6th May

SAT&SUN (Weekend Batch)
View Details
Comments
0 Comments

Join the discussion

Browse Categories

webinar REGISTER FOR FREE WEBINAR
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP

Subscribe to our Newsletter, and get personalized recommendations.

image not found!
image not found!

Top 50 Android Interview Questions You Must Prepare In 2023

edureka.co