In this COVID-19 pandemic, the world is moving from the “work from office” culture to the “work from home” culture. Also, people across the world are now depending on apps whether it’s for daily tasks like shopping, commuting, paying bills, or it’s getting information and staying connected with one another. Because of this reason, companies are not shying away from extending increased Android Developer salaries in India. According to PayScale, the average Android Software developer salary in India is ₹399,594 / year.
Additionally, the better the experience, the higher the salary. Similarly, the average experienced Android developer’s salary in India is ₹1,316,973 . These are the numbers in India. If we talk about the Android Developer Salary in the US and the UK then the numbers are $113,900 and £35,554 respectively. And one more interesting thing is that more than 6000 apps are released on Google Play Store every day!!
But is it easy to build your career in “Android Software Development”? What are the processes or steps to get into the Android Development World? What are the questions asked in the Interview Round? So let’s discuss the process or steps to get into the Android Development World in brief.
In general, the company hires for the following 3 roles:
Questions to be Expected
From tech giants like Google, Amazon, Facebook , etc to the rising startups like Dream11, Zomato, Paytm, CRED , etc are hiring lots of Android Developers for their companies. So we have prepared a list of Top 50 Android Interview Questions along with their answers and the questions are designed from fresher to advanced level serially.
Android is an operating system that is built basically for Mobile phones. It is based on the Linux Kernel and other open-source software and is developed by Google. It is used for touchscreen mobile devices such as smartphones and tablets. But nowadays these are used in Android Auto cars, TV, watches, cameras, etc. It has been one of the best-selling OS for smartphones. Android OS was developed by Android Inc.
The latest version of Android is Android 14 (API level 34) and the initial stable release date is October 4, 2023 .
To read more, refer to the article: Introduction to Android
Activity class is one of the very important parts of the Android component. Any app, no matter how small it is (in terms of code and scalability), has at least one Activity class. Unlike most programming languages, in which the main() method is the entry point for that program or application to start its execution, the android operating system initiates the code in an Activity instance by invoking specific callback methods that correspond to specific stages of its lifecycle . So it can be said that An activity is the entry point for interacting with the user.
To read more, refer to the article: Introduction to Activities in Android
XML stands for Extensible Markup Language . XML is a markup language much like HTML used to describe data. XML itself is well readable both by humans and machines. Also, it is scalable and simple to develop. In Android, we use XML for designing our layouts because XML is a lightweight language, so it doesn’t make our layout heavy.
There are some necessary building blocks that an Android application consists of. These loosely coupled components are bound by the application manifest file which contains the description of each component and how they interact. The four main components of android applications are:
To read more, refer to the article: Components of an Android Application
DVM is a virtual machine to execute Android applications. The Java bytecode (.class file) generated by the javac compiler is converted into Dalvik bytecode to make the application source files executable on the DVM. Since Android devices have a definite processing capacity, memory, and battery life, the DVM design principle aims to optimize itself so that it can load fastly and run smoothly even on low memory/powered devices. This virtual machine is very efficient in running multiple instances on the same device.
To read more, refer to the article: DVM
Dalvik Virtual Machine
Android Run Time
ART converts it just once at the time of app installation. That makes CPU execution easier.
Improved battery life due to faster execution.
To read more, refer to the article: Difference Between Dalvik and ART in Android
Developing an android application involves several processes that happen sequentially. After writing the source code files, when developers click the Run button on the Android studio, plenty of operations and processes start at the backend.
To read more, refer to the article: How Does Android App Work?
A Toast is a short alert message shown on the Android screen for a short interval of time. Android Toast is a short popup notification that is used to display information when we perform any operation in our app. It disappears automatically. If the user wants a permanently visible message, then a notification can be used.
To read more, refer to the article: Toast
Services in Android are a special component that facilitates an application to run in the background in order to perform long-running operation tasks. The prime aim of a service is to ensure that the application remains active in the background so that the user can operate multiple applications at the same time. A user interface is not desirable for android services as it is designed to operate long-running processes without any user intervention. A service can run continuously in the background even if the application is closed or the user switches to another application.
To read more, refer to the article: Services in Android
In Android, Content Providers are a very important component that serves the purpose of a relational database to store the data of applications. The role of the content provider in the android system is like a central repository in which data of the applications are stored, and it facilitates other applications to securely access and modify that data based on the user requirements. The Android system allows the content provider to store the application data in several ways. Users can manage to store the application data like images, audio, videos, and personal contact information by storing them in SQLite Database, in files, or even on a network.
To read more, refer to the article: Content Providers in Android
Broadcast in android is the system-wide event that can occur when the device starts, when a message is received on the device, when incoming calls are received, or when a device goes to airplane mode, etc. Broadcast Receivers are used to respond to these system-wide events. Broadcast Receivers allow us to register for the system and application events, and when that event happens, then the registered receivers get notified. There are mainly two types of Broadcast Receivers:
To read more, refer to the article: Broadcast Receiver in Android
Gradle is a build system (open source) that is used to automate building, testing, deployment, etc. “Build.gradle” are scripts where one can automate the tasks. For example, the simple task to copy some files from one directory to another can be performed by Gradle build script before the actual build process happens.
Usage: Every Android project needs a Gradle for generating an apk from the .java and .xml files in the project. Simply put, a Gradle takes all the source files (java and XML) and applies appropriate tools, e.g., converts the java files into dex files and compresses all of them into a single file known as apk that is actually used.
To read more, refer to the articles: build.gradle file , Introduction to Gradle
In Android, the fragment is the part of Activity that represents a portion of the User Interface(UI) on the screen. It is the modular section of the android activity that is very helpful in creating UI designs that are flexible in nature and auto-adjustable based on the device screen size. There are mainly 3 types of fragments:
To read more, refer to the article: Introduction to Fragments
RecyclerView is a ViewGroup added to the Android Studio as a successor of the GridView and ListView. It is an improvement on both of them. It has been created to make possible construction of any lists with XML layouts as an item that can be customized vastly while improving the efficiency of ListViews and GridViews . This improvement is achieved by recycling the views which are out of the visibility of the user. For example, if a user scrolled down to a position where items 4 and 5 are visible; items 1, 2, and 3 would be cleared from the memory to reduce memory consumption.
To read more, refer to the article: RecyclerView in Android with Example
An Intent is an object passed to Context.startActivity(), Context.startService() or Activity.startActivityForResult() etc. to launch an activity or get an existing activity to do something new. On the other hand, an Intent filter describes the capability of the component(like activities, services, and broadcast receivers).
To read more, refer to the article: Difference Between Implicit Intent and Explicit Intent in Android
Every project in Android includes a manifest file, which is AndroidManifest.xml, stored in the root directory of its project hierarchy. The manifest file is an important part of our app because it defines the structure and metadata of our application, its components, and its requirements. This file includes nodes for each of the Activities, Services, Content Providers, and Broadcast Receivers that make the application and using Intent Filters and Permissions determines how they coordinate with each other and other applications. The manifest file also specifies the application metadata, which includes its icon, version number, themes, etc., and additional top-level nodes can specify any required permissions, unit tests, and define hardware, screen, or platform requirements.
To read more, refer to the article: The Application Manifest File
Android SDK stands for Android Software Development Kit which is developed by Google for Android Platform. With the help of Android SDK, we can create Android Apps easily. Android SDK is a collection of libraries and Software Development tools that are essential for Developing Android Applications. Whenever Google releases a new version or update of Android Software, a corresponding SDK also releases with it. In the updated or new version of SDK, some more features are included which are not present in the previous version. Android SDK consists of some tools which are very essential for the development of Android Application. These tools provide a smooth flow of the development process from developing and debugging. Android SDK is compatible with all operating systems such as Windows, Linux, macOS, etc.
Components:
To read more, refer to the article: Android SDK and its Components
These are the different stages of the Activity Lifecycle:
To read more, refer to the article: Activity Lifecycle in Android with Demo App
The reason for doingso is that the activity life cycle onCreate() method is called only once. And this is the big reason we need to call the setContentView() in onCreate(). And it will be inefficient to call this function in onResume(), onStart(), and somewhere else because those methods are called more than once.
These are the different stages of the Activity Lifecycle:
To read more, refer to the article: Fragment Lifecycle in Android
To read more, refer to the article: Difference Between a Fragment and an Activity in Android
The context in Android can be understood as something which gives us the context of the current state of our application. We can break the context and its use into three major points:
There are mainly two types of context available in Android.
To read more, refer to the article: What is Context in Android?
To read more, refer to the article: Top Image Loading Libraries in Android
The view is a class that represents the basic building block for UI components. A View occupies a rectangular area on the screen and is responsible for drawing and event handling. It is a superclass for all the UI components. The most common UI components are:
To read more, refer to the article: Difference Between View and ViewGroup in Android
The Kotlin team defines coroutines as “ lightweight threads ”. They are sort of tasks that the actual threads can execute. Kotlin coroutines introduce a new style of concurrency that can be used on Android to simplify async code. The official documentation says that coroutines are lightweight threads. By lightweight, it means that creating coroutines doesn’t allocate new threads. Instead, they use predefined thread pools and smart scheduling for the purpose of which task to execute next and which tasks later .
To read more, refer to the article: Kotlin Coroutines on Android
Garbage Collector in Android has no compacting. This means the address of objects in the heap never changed after their creation. So garbage collection can be triggered when an allocation fails when an
When developers work on a real mobile application whose nature is dynamic and will expand its features according to the user’s need, then it is not possible to write core logic in activities or fragments. To structure the project’s code and to give it a modular design(separated code parts), architecture patterns are applied to separate the concerns. The most popular android architectures used by developers are the following:
So you have to tell the architecture of the last app you have developed during the college time project or in a real industry project.
To read more, refer to the article: Android Architecture Patterns
MVC(MODEL VIEW CONTROLLER)
MVP(MODEL VIEW PRESENTER)
MVVM(MODEL VIEW VIEWMODEL)
Which one should we choose?
To read more, refer to the article: Difference Between MVC, MVP and MVVM Architecture Pattern in Android
To read more, refer to the article: How to Reduce APK Size in Android?
Jetpack is nothing but a set of software components, libraries, tools, and guidance to help in developing great Android apps. Google launched Android Jetpack in 2018. Key Benefits of Android Jetpack
To read more, refer to the article: Introduction to Android Jetpack
The software components of Android Jetpack has been divided into 4 categories:
Jetpack Compose is a modern UI toolkit recently launched by Google which is used for building native Android UI. It simplifies and accelerates the UI development with less code, Kotlin APIs, and powerful tools.
To read more, refer to the article: Jetpack Compose in Android
Architecture Components could be classified as follows:
To read more, refer to the article: Jetpack Architecture Components in Android
To read more, refer to the article: How to Improve RecyclerView Scrolling Performance in Android?
Volley is an HTTP library that makes networking very easy and fast, for Android apps. It was developed by Google and introduced during Google I/O 2013. It was developed because there is an absence in Android SDK, of a networking class capable of working without interfering with the user experience. Although Volley is a part of the Android Open Source Project(AOSP), Google announced in January 2017 that Volley will move to a standalone library. It manages the processing and caching of network requests, and it saves developers valuable time from writing the same network call/cache code again and again.
To read more, refer to the article: Volley Library in Android
Retrofit is a type-safe REST client built by square for Android and Java which intends to make it simpler to expand RESTful web services. Retrofit uses OkHttp as the system’s administration layer and is based on it. Retrofit naturally serializes the JSON reaction utilizing a POJO (PlainOldJavaObject) which must be characterized as cutting edge for the JSON Structure. To serialize JSON we require a converter to change it into Gson first. Retrofit is much simpler than other libraries; we don’t have to parse our JSON. It directly returns objects but there is one disadvantage: it doesn’t provide support to load images from the server, but we can use Picasso for the same.
To read more, refer to the article: Introduction to Retrofit
Model — View — ViewModel (MVVM) is the industry-recognized software architecture pattern that overcomes all drawbacks of MVP and MVC design patterns. MVVM suggests separating the data presentation logic(Views or UI) from the core business logic part of the application.
To read more, refer to the article: MVVM (Model View ViewModel) Architecture Pattern in Android
To read more, refer to the article: What are the reasons your android app is legging?
On Android what happens with the processors is one process can’t normally access the memory of another process. So in order to interact they need to decompose their objects into primitives that the OS can understand and gather the objects across that boundary. The code to do that gathering is very complex to write, so Android handles it with AIDL. So generally AIDL is similar to the other IDLs and it allows to define the programming interface that both the client and service agree upon in order to interact with each other using interprocess communication (IPC).
ANR stands for Application Not Responding . An ANR will occur if you’re running a process on the UI thread which takes an extended time , usually around 5 seconds. During this point, the GUI (Graphical User Interface) will lock up which can end in anything the user presses won’t be actioned. After the 5 seconds approx. has occurred, if the thread still hasn’t recovered then an ANR dialogue box is shown informing the user that the appliance isn’t responding and can give the user the choice to either wait, in the hope that the app will eventually recover, or to force close the app.
Stop doing heavy tasks on the main thread. Instead, use worker threads such as IntentService, AsyncTask Handler, or another Thread simply. Detecting where ANRs happen is straightforward if it’s a permanent block (deadlock acquiring some locks for instance), but harder if it’s just a short-lived delay. First, re-evaluate your code and appearance for vulnerable spots and long-running operations.
To read more, refer to the article: What is ANR and How it Can be Prevented in Android?
The NDK (Native Development Kit) is a tool that allows you to program in C/C++ for Android devices. It provides platform libraries one can use to manage native activities and access physical device components, such as sensors and touch input. NDK can be useful for cases in which you need to do one or more of the following:
JUnit is a “ Unit Testing ” framework for Java Applications which is already included by default in android studio. It is an automation framework for Unit as well as UI Testing. It contains annotations such as @Test, @Before , @After , etc. Here we will be using only @Test annotation to keep the article easy to understand.
To read more, refer to the article: Unit Testing in Android using JUnit
Dagger is a Dependency Injection framework that will generate a lot of boilerplate code for you to achieve the goal of Dependency injection in Android development. Not that one must have a good understanding of Dependency Injection before answering this question.
When to use a dagger?
Manual DI Service Locator Dagger
LiveData component is an observable data holder class i.e, the contained value can be observed. LiveData is a lifecycle-aware component and thus it performs its functions according to the lifecycle state of other application components. Further, if the observer’s lifecycle state is active i.e., either STARTED or RESUMED, only then LiveData updates the app component. LiveData always checks the observer’s state before making any update to ensure that the observer must be active to receive it. If the observer’s lifecycle state is destroyed, LiveData is capable of removing it, and thus it avoids memory leaks. It makes the task of data synchronization easier.
Advantages of LiveData component:
To read more, refer to the article: Jetpack Architecture Components in Android
Data Binding library is a support library that provides the feature of binding UI components in an activity/fragment to the data sources of the application. The library carries out this binding task in a declarative format and not in a programmatic way. Below is an example to understand the working of this library accurately:
To find a TextView widget and bind it to the userName property of the ViewModel variable, the findViewById() method is called:
TextView textView = findViewById(R.id.sample_text);
textView.setText(viewModel.getUserName());
After using the Data Binding library, the above code changes by using the assignment expression as follows:
Advantages of Data Binding Component:
To read more, refer to the article: Jetpack Architecture Components in Android
The requirement of a database in Android is fulfilled by SQLite from the very beginning. However, it comes with some severe drawbacks like not checking the queries at compile-time, it does not save plain-old-Java Objects(commonly referred to as POJOs). Developers also need to write a lot of boilerplate code to make the SQLite database work in the Android OS environment. The Room component comes into the picture as an SQLite Object Mapping Library which overcomes all the mentioned challenges. Room converts queries directly into objects, checks errors in queries at the compile-time, and is also capable of persisting the Java POJOs.
Moreover, it produces LiveData results/observables from the given query result. Because of this versatile nature of the Room component, Google officially supports and recommends developers to use it. The Room consists of the following sub-components:
To read more, refer to the article: Jetpack Architecture Components in Android
ViewModel is one of the most critical classes of the Android Jetpack Architecture Component that support data for UI components. Its purpose is to hold and manage the UI-related data. Moreover, its main function is to maintain the integrity and allows data to be serviced during configuration changes like screen rotations. Any kind of configuration change in Android devices tends to recreate the whole activity of the application. It means the data will be lost if it has not been saved and restored properly from the activity which was destroyed. To avoid these issues, it is recommended to store all UI data in the ViewModel instead of an activity.
To read more, refer to the article: Jetpack Architecture Components in Android
KTX library is the only one among the foundation components which was introduced for the first time with the release of the Jetpack. Android KTX is a collection of Kotlin extensions that are designed to facilitate developers to remove boilerplate code as well as to write concise code while developing android applications with Kotlin language. Here KTX in the name stands for Kotlin Extensions . Below is an example of a piece of code without using and after using the Android KTX library:
Code snippet of SQLite without using KTX library:
db.beginTransaction()
try <
// insert data
db.setTransactionSuccessful()
>finally <
db.endTransaction()
>
Above code after using KTX library:
To read more, refer to the article: Foundation Components of Android Jetpack