Android is one of the most popular mobile platforms, an OS, ruling the process of running the devices successfully, out there. In the competitive world, the more you know about the technology, the more the chances of you getting recruited. As we know that Android increases the weightage to your resume, here we are presenting the compilation of 101 Important Android basic Interview Questions that help the freshers to ace the Interview. Ready?
Android is an ideal and complete set of software that consists of the OS, middleware, and the most important mobile applications one looks for. As Android OS is open-source and by its strong compatibility, the OS works on various hardware suppliers like Samsung, OnePlus, Google Pixel, HTC, Sony, etc. So, the customers have wider choices to pick out a product based on the manufacturer they like. The cherry on the top is – Android products are cheaper compared to Apple’s IOS.
So, we know that it is a bit tough to crack interviews, although you have a good knowledge of this particular skill. To boost up the confidence levels in you, we strongly suggest you go through our predicted and reliable compilation of Android Interview Questions which helps in polishing the basic knowledge much stronger.
Android is a package of software that mainly consists of an Operating System, along with the middleware and hundreds of needed applications. It is an open-source framework and relies upon Linux that helps in developing advanced and user-friendly applications. Android works on many hardware manufactured supplies such as OnePlus, Samsung, Sony, etc. This OS was developed by Google and supports various touch screen devices such as Tablets, Cell Phones, Televisions, etc.
Have a look at the picture below, to understand the life cycle process easily.
The Android Architecture consists of a stack of prominent elements that are helpful to run a device. It is organized in layers.
The architecture is comprised of five levels, namely :
Applications
Android Framework
Android Runtime
Platform Libraries
Linux Kernel
An activity is a screen with which the user interacts, precisely, a user interface such as a window or frame on which we can input data or we can get the output. The best examples are the pop-up windows, web pages, any interface with which you interact on the screen.
APK is an abbreviation for ‘Android Application Package’ which is a kit in the file format used on the Android Operating system and on other OS distribution systems that support it. This file formatted package consists of the software code and media needed and is mainly used to install various supported files which can be games, applications, etc.
The intent is a messaging element that passes the information from one application to the other by raising the requests. It displays the notification or pop-up important messages to the user from within the Android enabled device on the interface/screen itself. It alerts the user about the happening of an event. If we think that all the components of an Android are isolated, the only way to arrange communication between them is through intents.
There are two types of Intents in Android, namely :
Implicit Intents: Application doesn’t define its specific target component in an Intent to be raised.
Explicit Intents: Application defines its target component in an Intent to be raised.
Explicit Intent is an Intent where the application defines its specific target when its Intent to be raised. Here, the developer has control over which class should be launched.
Intent i = new Intent(this, 3rdQuestion.class);
startActivity(i)
Here, from the current page, the 3rdQuestion (defined target component) is going to be opened once the intent object is passed through the startActivity().
Implicit Intent is an Intent where the application doesn’t define its target when its Intent to be raised. It is the work of the android operating system to filter out which component is going to give a response to the action.
Intent i = new Intent(this, Uri.parse(https://o7services.com/));
startActivity(i)
Here, from the current page, the https://o7services.com/ will be opened directly (as no inner component is specified) once the intent object is passed through the startActivity().
In Android, most of the functionalities are done with help on intended actions. An Action in Android technology is nothing but the thing the user wants to do with the applications in android or what he expects to get as a response when the intents are raised. Simply, the changes expected to be done on the screen of the interface when the intents are raised. The above are the commonly asked Android Interview Questions for Freshers and Experienced candidates in an Android Interview.
ADB is an abbreviation that stands for ‘Android Debug Bridge’, which is a command-line tool that allows the developers the power to perform and execute the remote shell commands. This tool helps in communicating with and controls Android devices and computers or other supportive devices connect over a USB port. Simply, Allowing and controlling the communication exchange towards and from the emulator ports is its basic function.
ANR is an abbreviation that stands for ‘Application Not Responding’. It is a dialog or message box that gives an alert message about the unresponsiveness of an application, whenever the application takes a long time to respond for intent or action.
ANR is a dialog box that informs the user about the unresponsiveness of an application. There are two possible conditions where ANR dialog is expected to be displayed.
When the User Interface thread takes around 5 seconds or much more time to get executed. In such cases, the Graphical User Interface gets locked up, resulting in unresponsiveness.
When the crash occurs or when a Broadcast Receiver doesn’t finish the execution within 10 Sec.
It is better if we avoid including long-running tasks in the UI thread. In the case of ANR occurrence, or in the scope of UI to be unresponsive, it is better to create a child or worker class in which we can place database and network operations, etc. Other best things to follow are – to raise a progress dialog to the user if you are doing a background work; If it is a game, place calculations on child thread, etc.
AIDL is an abbreviation for ‘Android Interface Definition Language’. It helps in providing the same level of communication between the client and server through Interprocess Communication (IPC) by handling the interface requirements. As processes are independent and one process can’t access the part of other processes, AIDL helps in breaking down the process into the primitive processes or parts further making it easy for the Android OS to understand and compute it.
AIDL supports the following data types:
string
charSequence
List
Map
and all the primitive data types of Java – int, long, char, and Boolean.
The file that represents Android Manifest is AndroidManifest.xml. It contains the package (package name matches your code’s namespace) of information about the application along with its components. It passes the information about the application to the Android tools, Google Play, and mainly, to the OS.
What is a Fragment?
A primitive part of an activity is known as a fragment. They are reusable and reliable. You can move the fragment around the activity and can combine it with other fragments that belong to the same activity.
A Sticky Intent is an intent that is used with a sticky broadcast allowing the communication between function and service. Here, sendStickyBroadcast() performs a sendBroadcast(Intent). The sticky intent moves around even after the completion of the broadcast, allowing the users to retrieve the data from the return value registerReceiver(BroadcastReceiver, IntentFilter). These are the generally asked Android Interview Questions and Answers for the fresher candidate in the Interview.
Portable Wi-Fi Hotspot is a hotspot that allows one to share their device’s internet connection with other wireless devices. Portable means easy and handy, which says that it is a handy internet hotspot to share the internet with any suitable devices with the help of one device. For example, using an access point, you can share your Android’s internet with other phones, laptops, etc.
Talking of an activity, the 4 essential states of it are :
Active – Here, the activity is at the foreground
Paused – Here, the activity is in the background and is still visible.
Stopped – Here, the activity is not visible or stopped by another activity.
Destroyed – Here, either the activity is fully terminated or killed.
.
Entire lifetime: Loop where the activity happens between onCreate() and onDestroy().
Visible lifetime: Loop where the activity happens between onStart() and onStop().
Foreground lifetime: Loop where the activity happens between onResume() and onPause().
Majorly, there are 4 types of dialog boxes we often use in our Android Applications. They are :
AlertDialog
ProgressDialog
DatePickerDialog
TimePickerDialog
The main storage options for data persistence are:
Shared Preferences: It is all about storing the private fundamental data in key-value pairs. Can’t save the user-defined java types.
Internal Storage: Stores the private data on the device memory.
The maximum parts of Android are developed in Java programming language, in such a way that its APIs too – are designed to be called with Java. It is java with which almost every application is being designed because of the feasibility it provides to quickly learn to create and deploy applications in the Android environment. C and C++ can also be used to create the android apps with their Android Native Development Kit. However, Google doesn’t promote C and C++ usage in creating apps.
A bitmap is a raster graphic, a digital image that is composed of a continuous matrix of dots. When clear zoom in or 100% resolution, we can see that each dot corresponds to an individual pixel on a display, where each dot can be of a different color. Nine-patch image is a regular png with stretchable regions, where you can resize the image – 4 corners that are unscaled, 4 edges that are scaled in 1 axis, and coming to the middle one, it can be scaled into both axes.
Using XMPP for the transmission of data, The Google translator translates the data of one language into the other, easily, in an Android. Else, you can just type a sentence in the left textbox by selecting the corresponding language, and then, can translate the text entered into another desirable language by choosing the language to be converted into, in the right box.
The answer is a ‘No’. As the new version comes on, most of the android phones lose their ability to support the new version much earlier due to the various changes to be made. Whenever Google releases a new Android version, then manufacturers have to adopt the version in and manufacture the phones in such a way that they possess the ability to support the features present in the new version.
The compilation of a file of a typical Android application project gives a .apk file. The .apk file is generally made up of AndroidManifest.xml file, application program/code, resource files, and other related files.
5 major core components are present under the Android application architecture. They are :
Services
Intent
Resource externalization
Notifications
Content providers
To remove the icons and widgets from the main screen of the Android device is :
Press and hold that icon or widget.
Drag it downwards to the lower portion of the screen where a remove button appears, and drop that icon or widget on the remove button/ label until you see the icon/widget disappears.
The best time to kill a foreground activity will be when it is already consuming too much memory. When the application running in the foreground activity reaches the memory paging, it will be killed to retain the responsiveness of the User Interface to the user.
Yes. Using the method add(Fragment, string), we can add a fragment from the activity without using a user interface as it is done when you want to create a behavior in the background for the certain and specific activity.
When dealing with the multiple resources that are ideal with the device configuration, the ‘locale’ qualifier is the one that takes precedence over all almost every single time.
Default resources contain the default string and files. In the absence of this resource, the errors keep on occurring repeatedly causing the failure of the application run. It helps the application to run healthy in the desired conditions while accessing the resources from the subdirectories under the project res/ directory.
Tell us the steps to create a bounded service through AIDL.
To define a programming interface, create a .aidl file.
To extend the inner abstract Stub class and implanting its methods, Implement the interface.
Expose the interface, to implement the service to the clients.
The proper way of setting up an Android-powered device for app development is :
Declare the application as “debuggable” in Android Manifest.
Turn on the device’s “USB Debugging”
Set up the system to detect your device.
The AndroidManifest.xml is a package (package name matches your code’s namespace) of information about the application along with its components. It passes the information about the application to the Android tools, Google Play, and mainly, to the OS.
Dalvik is a virtual machine that runs every Android application. It works almost like a Java Virtual Machine (JVM). Using Dalvik Virtual Machine, an android device can execute multiple virtual machines efficiently with better memory management. Android Training in jalandhar at O7 Solutions provides in-depth training of the Android concepts under the guidance of real-time professionals.
Bean Class is also known as JavaBeans, where beans indicate the components of the class. Javabeans is a model that is platform-independent, portable and is written in a java programming language. The deal with these classes is, they group many objects into a single one. It allows the user to access the properties using getter and setter class methods.
The synchronization taken and accessing the data of an application without internet connectivity is known as offline synchronization. Offline games are the best examples.
Generally, 5 seconds or more is considered as ANR’s responding time in Android. ANR is an abbreviation for ‘Application Not Responding’. When the User Interface thread takes around 5 seconds or much more time to get executed. In such cases, the Graphical User Interface gets locked up, resulting in unresponsiveness.
The four different states wherein a process is based are :
Foreground activity
Visible activity
Background activity
Empty process
The onStop() method is invoked (called) just before the activity needs to get destroyed. Or simple, when the User Interface is no longer visible to the user either because of the overriding by other applications or prioritized.
The onPause() method is invoked when the User Interface is partially visible to the user. The instance is like when a dialog box pops up, the UI gets unresponsive and partially visible unless you make an action over the dialog. Here, the dialog activity calls the onPause() method.
No, It is not necessary. If it is called – only a specific part of the process, a particular activity will be destroyed. So, it is called before the activity is destroyed.
A container can be called a package or a view that contains a certain number of other views. For example, if we take a header part of the android, If the total header is one view, it contains the set of other views such as Title, Menu bar, Logo, etc. So, These container classes are called layouts, and the subviews can be called children views.
The function of an Intent Filter is to filter out the intents that the components are willing to receive and respond to. Depending upon the activities and services that a component is going to perform, the number of intent filters used may vary, be they one or more.
The importance of settings permissions in app development is to restrict access primarily, to protect the data, code, and other important files. Without these, the manipulations can be done on the code, which may disturb and defect the functionality of an activity or an application.
Characters that are illegal to use in a string, are replaced by the escape characters. The escape characters are preceded with double backslashes as in \n is a newline character and \t is a tab space character.
and (manifest and application) are the elements that can occur only once and must be present in the manifest file.
In Android, the layouts are placed as XML files in the Layout folders.
Nine-patch image tool is a tool used to resize the image, splitting the simple bitmap image into 9 portions/sections – 4 corners that are unscaled, 4 edges that are scaled in 1 axis, & coming to the middle one, it can be scaled into both the axis. Nine-patch image is a regular png with stretchable regions.
AlertDialog: It shows a title, some list of selected items, or a customized layout, with a maximum of 3 buttons.
ProgressDialog: It is the extension of AlertDialog, and shows us the progress bar.
DatePickerDialog: It comes with a predefined UI allowing the user to select a date.
TimePickerDialog: It comes with a predefined UI allowing the user to select the time.
The exceptions available in android are :
InflateException,
Surface.OutOfResourceException,
SurfaceHolder.BadSurfaceTypeException,
WindowManager.BadTokenException
The order of dialog-box in android is :
Positive > Neutral > Negative
Using the Webkit engine, Web view is used to display a web page that can be loaded either directly from the application or through URL as a part of the Android application’s activity layout. However, the absence of navigation control and address bar can be seen.
In Android, A Graphical/Compiled visual resource which can be used as a background, banners, icons, splash screen, etc. is known as a Drawable folder. Based on the resolution of graphical images, the drawable folder is divided into 3 types. HDPI image folder (maintains images of Higher resolution), LDPI (for Lower resolution images), MDPI (for medium resolution images).
By using findViewById(), we can find any view element in a program. It returns an instance of view based on the intent or activity targeted. These are the commonly asked Android Interview Questions for freshers & experienced candidates in an interview.
App Widgets are small application icon views that can be embedded in other applications and receive notification of the status, periodically. Like weather reports, or gaming icons present in Home Screen.
The kernel used in an Android device is the customized Linux 3.6 Kernel. It is the heart of the Android OS as it is what controls every software and hardware functions in it.
Sleep mode is nothing but the mode in which the CPU will be sleeping. As the CPU becomes idle in this mode, it doesn’t accept any commands from an android device except the alarm & Radio interface layer.
In Android, a singleton class is a class that can have only one object for itself and ensures that it’s the only object which is present in the Java Virtual Machine representing that class. However, the object can be shareable to all other classes. The real-time example for it is – The President’s office in India is Singleton.
In Android, we can launch an activity using an Intent.
Example 1 (Explicit):
Intent i = new Intent(this, 3rdQuestion.class);
startActivity(i)
Example 2 (Implicit):
Intent j = new Intent(this, Uri.parse(https://o7services.com/));
startActivity(j)
A user can stop the services by using the methods stopSelf() and stopService().
The stopSelf() method is used to stop the current service running in the system. This method is intended to get called from inside the service only. If you pass the id through it, the id must be the latest service started. However, if the service receives the new request before you call the stopSelf() method, the service won’t stop, rather runs the new request ignoring the stopSelf() method.
The stopService() method or stopService(Intent service) is used to stop the services when the method should get called from outside the service.
The time limit of the broadcast receiver in android is 10 seconds. If the crash happens or when a Broadcast Receiver doesn’t finish the execution within 10 Sec, ANR occurs.
The method used for broadcast receivers in the Android life cycle is onReceive() method. The above are the frequently asked Android Interview Questions & Answers for the Freshers and Experienced candidate in an interview.
In Android, the use of a content provider is to share the data between applications using intents.
FULL_WAKE_LOCK are the wake locks available in android. Wake locks are nothing but the indications to your device to keep it on working, precisely, making sure that the device doesn’t doze off.
Application class works as the base class for all other classes and its components like services and activities. This is a pre-defined class. So, there is no need to import or extend this class.
The features that are considered while creating android apps are Screen Size, Input configuration, Platform Version, Device features, etc.
In Android, JNI is an abbreviation for ‘Java Native Interface’, which is a part of Java’s SDK and helps in defining a way for the bytecode of the Android compiles from managed code (written in the Java or Kotlin) to interact with native code (written in C or C++).
The android is currently supporting majorly four types of orientations, namely :
Portrait
Landscape
Sensor
Unspecified
Yes, a class can be an Immutable one. The class must be declared as a final class to turn it into an immutable one.
There are 3 types of notifications present in Android, majorly. They are :
Toast notification,
Status bar notification,
Dialog notification.
In Android, Sandbox is a kernel-level application that isolates the app data and code execution from each other. So, it protects the apps and their resources from other malicious apps.
App Level Security And Kernel Level Security are the levels of securities that are present in android.
There are three protection levels present in the android permission tag. They are :
Normal Protection Level,
Signature Protection Level,
Dangerous Protection Level.
No, It is not mandatory. We can write the program without using onCreate() and onStart() in android. It works fine. However, to complete the life cycle of an Android Architecture, we mention them.
There are two return types for startActivityForResult() in android. They are :
RESULT_CANCEL
RESULT_CRASH
The transient data in android is nothing but logical data. Transient data is created within an application. In the end, the data is either discarded or reset back to its default state.
In android, The commands that are needed to create an APK file are:
Javac
Dx tool
Aapt tool
Jarsigner tool
Zipalign
Set won’t accept the duplicate elements, where the list can contain the duplicate elements and is mutable.
In Android, Interface is nothing but the bridge or a medium of communication between the classes/intents/activities of the Android with the outer world (users).
Anchor view is the view that provides the information on respective relative positions. It is represented by instances of the LMAnchorView.
In android, the flow of fragment life cycle is as follows:
onAttach() -> onCreate() -> onCreateView() -> onActivityCreated() -> onStart() -> onResume().
The thread is a small, independent dispatchable and concurrent unit that works on independent execution in a program. Every application has several threads within, that executes the activities concurrently. When the execution is started, each virtual machine instance has at least one main Thread running. Android Training in jalandhar at O7 Solutions provides a holistic training of the Android App Development concepts and its application under the guidance of real – time professionals.
AAPT means Android Asset Packaging Tool. This tool helps developers to deal with zipping compatible archives, creating, extracting and for viewing its contents.
The sensors are built-in devices in an android device. The data of the motion, orientation, environment around us, etc. is provided based on the working of hardware sensors and software sensors. They provide the data with high accuracy.
Today, the android mobile devices are packed with nearly 14 sensors. The data of the motion, orientation, environment around us, etc. is provided based on the working of hardware sensors and software sensors. All thanks to the micro-electromechanical systems.
The abbreviation SDK stands for ‘Software Development Kit’. It enables the developers to create applications for the Android platform. The Android SDK contains sample projects with source programs, some development tools, libraries to build Android applications, etc. The best examples are Windows 7 SDK, the Mac OS X SDK, etc.
The predefined thread classes are four in number. They are :
AsyncTask (For start and stop of UI threads)
HandlerThread (for callbacks)
ThreadPoolExecutor (for parallel work)
IntentService (for getting intents off the UI thread)
Generally, In threads, there are three priorities. The priority numbers are integers ranging from 1 to 10. They are :
MAX_PRIORITY
MIN_PRIORITY
NORM_PRIORITY
Explain the thread priorities.
MAX_PRIORITY: The maximum priority that a thread can possess. The constant value of it is 10.
MIN_PRIORITY: The minimum priority that a thread can possess. The constant value of it is 1.
NORM_PRIORITY: The default priority that a thread possesses. The default value of this type of priority is 5.
The Exceptions supported by the Android are :
InflateException
Surface.OutOfResourceException
SurfaceHolder.BadSurfaceTypeException
WindowManager.BadTokenException
SurfaceTypeException
It is a command-line tool that is well known for logging utility. It allows access to the messages from applications to services running on an Android device.
The following are the names of the android with their versions:
Android 1.5: Android Cupcake
Android 1.6: Android Donut
Android 2.0: Android Eclair
Android 2.2: Android Froyo
Android 2.3: Android Gingerbread
Android 3.0: Android Honeycomb
Android 4.0: Android Ice Cream Sandwich
Android 4.1 to 4.3.1: Android Jelly Bean
Android 4.4 to 4.4.4: Android KitKat
Android 5.0 to 5.1.1: Android Lollipop
Android 6.0 to 6.0.1: Android Marshmallow
Android 7.0 to 7.1: Android Nougat
Android 8.0 to Android 8.1: Android Oreo
Android 9.0: Android Pie
Android 10.0: Google is under talks of selecting a dessert name for this version. For now, it is being called as ‘Android 10’.
Activities running and closing/ termination are completely based on the user’s choice while services are mostly about the background work, designed to run behind the scenes. So, the services mostly work independently, where activities don’t.
We have covered almost every topic in Android with the motto of preparing you to face the Interview Questions on ‘Android’ topic, strongly. However, these 101 questions are most popular and are predicted to be asked in the interview, by our team. We hope these lists of Interview Questions will help you. Hope you will ace the questions asked on ‘Android’ with your answers. Good luck!