These days everyone is aware of android because it has a huge market all over the globe. Google, the parent company of Android, hire developers from across the world for further Android development. Even the Android which has an infinite number of Applications on its play store promising a bright future to its developers. so let’s discuss the best Android Interview Questions.
Many techs and non-tech companies are releasing their own Android applications to increase their reach in the market. Now having an android application has become like having a website for your company. Like Google, its child Android is also dominating the smartphones market with more than 70% active users. If you are an android developer and preparing for an upcoming interview, we suggest you go through these Android interview questions and answer, so you could ace the interview.
Android Interview Questions
Here in this article, we have provided the technical answers of Best Android interview questions, which you might face during the interview.
Question: What is Android?
Answer: Android is an open-source Operating System used by touch screen mobile devices and tablets and it is based on Linux Kernel.
Question: Name the latest version of Android?
Answer: Q Android 10.0 is the latest version of Android released in September 2019.
Question: Name all the Android version?
Answer: All Android versions are named alphabetically and on some dessert name.
|Android Version||Android Name||Release|
|7.0 – 7.1.2||Nougat||2016|
|6.0 – 6.0.1||Marshmallow||2015|
|5.0 – 5.1.1||Lollipop||2014|
|4.4 – 4.4.4||KitKat||2013|
|4.1 – 4.3.1||Jelly Bean||2012|
|4.0 – 4.0.4||Ice Cream Sandwich||2011|
|3.0 – 3.2.6||Honeycomb||2011|
|2.3 – 2.3.7||Gingerbread||2010|
|2.2 – 2.2.3||Froyo||1010|
Question: What is the Android SDK?
Answer: Android SDK (Software Development tool) is a tool used by the Android developers to create an application for the android platform, basically, it is used to emulate an Android environment. This is a very handy tool you can test how would your application run on Android mobile devices.
Question: Name the Android application components.
- Resource Externalization
- Content Provider
Question: Give some Advantages of Android.
- It is an open source platform
- Platform independent
- It supports various plugin the like camera, Bluetooth, Wi-Fi, speech recognition and lots more
- Highly Optimized Virtual Machines
Question: Which Programming languages Android supports?
Answer: In 2019 Google has announced Kotlin as its Official language for Android development before that there was no official language for Android and developers would use Java to develop Android application. Android support both Java and Kotlin.
Question: What is .APK?
Answer: .APK (Android Application Package) which is also known as the android app file extension, it is a compressed file format which contains all application code, resource files, certification and other files. All the application files are compressed in once so that it is easy to distribute and install.
Question: What is an Activity?
Answer: An activity is defined as the GUI of a single screen which performs an action on the screen, a complete application is made up of many activities. For example, if we have created an email application so its inbox interface would be an activity and its Draft interface would be another.
Question: Name all the Android Architecture layers.
- Linux Kernel
- Android Libraries
- Android Runtime
- Application Framework
Question: What does the Application Framework do in Android Architecture?
Answer: It is one the most important layer of Android architecture which provides many high-level services to the application in the form of Java Classes some of these services are Activity manager, Content Provider, Resource Manager, Notification Manager, View System and lots more.
Question: Why can’t we run Java byte code on Android?
Answer: Android have DVM (Dalvik Virtual Machine) not JVM (Java Virtual Machine) and to run Java Byte code we need JVM
Question: Name the lifecycle of Activities.
- OnCreate(): When the activity is created with the first interface.
- OnStart(): it summoned when the activity gets visible to the user.
- Onresume(): when user interacts with the activity this method is called
- Onpause(): when activity is running in the background
- OnStop(): when activity is hidden from the user
- OnDestroy(): when we need to terminate the activity.
- OnStart(): it stops the activity and brings back to the stat activity.
Question: What happens to the activity when a user rotates the screen?
Answer: When the user rotates the screen the instance of the current activity gets terminated and a new instance gets created simultaneously.
Question: What is intent in Android?
Answer: Intent aka intention, is used to perform actions. It is an object that sends message to the other components of the application and request for some action.
There are two types of Intent:
- Implicit Intent
- Explicit intent
Implicit Intent: In implicit intent, the android decides which component to target based on the evaluated data.
Explicit Intent: In explicit intent, the application decide which component of the other application to target.
Question: What is the different between Implicit and Explicit intent?
Answer: Implicit intent used when a user performs an action, for example, send a message, dial a number on the dial pad
Explicit helps the user to move from one activity to the another.
Question: What is the difference between the File, Class and Activity in Android?
- The file is used to store information.
- Class is used to hold functionality and it compiled from the java source file so the android uses its functionality.
- Activity, on the other hand, is a view or a user interface, so a user can also avail the class functionality.
Question: What are the containers?
Answer: 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.
Question: Name the tools present in Google SDK.
- Android Emulator
- DDMS – Dalvik Debug Monitoring Services.
- AAPT- Android Assets Packaging tool.
- ADB- Android debug bridge.
Question: What is an ANR?
Answer: ANR stands for Application Not Responding, this is used when the application main activity does not respond for a while. It depends on some conditions like if there is no response to input after 5sec or the broadcast receiver is not done executing within 10 seconds.
Question: What is AAPT?
Answer: AAPT stands for Android Asset Packaging Tool, it helps the developer to handle zip-compatible archives, that can create, extract and view the contents.
Question: How we pass data to sub-activities?
Answer: We use HashMaps like structure such as Bundles to carry trivial data from one activity to its sub-activities.
Question: Why is WebView and why we use it in android?
Answer: WebView is a window or view which is used to show web pages inside an android application, it gives a browser look to the application. WebView uses WebKit rendering engine to display web pages and it also includes some navigation tools like forwarding, backward and history.
Question: What is Context?
Answer: Context is a class that handles the current state of the running application, it provides services like resolving resources, get access to the database and so on.
There are two types of Context
- Application Context
- Activity Context
Question: How can we clear the back stack of Activities when a new instance of an activity is called?
Answer: We can use the FLAG_ACTIVITY_CLEAR_TOP flag or FLAG_ACTIVITY_CLEAR_TASK and FLAG_ACTIVITY_NEW_TASK in conjunction
Question: Define Content Provide.
The content provider is used to providing data from one application to another when it requested. It manages the structured set of data and also provides data security.
Question: Name the different storage methods in Android.
- Shared Preferences
- Internal Storage
- External Storage
- SQLite Databases
Question: Can we run JAR on android?
Answer: No, but we can compress it into Android Package (.apk) with the help of Asset Packaging Tool (APT) and then run it on the Android platform.
Question: What is a Fragment?
Answer: A fragment is a modular form of activity and it can also be understood as a part of Activity which can combine with other fragments in a single activity which makes it reusable.
Question: What does Dalvik do in Android development?
Answer: Dalvik is a virtual machine in android which executes the code and runs the application it can also execute the multiple virtual machines.
Question: Give the difference between Service and Intent Service.
Answer: Android Service is used to perform the operation in the background such as playing music, though it does not provide any User interface.
Intent Service is used to handle asynchronous requests on demand.
Question: What do you know about toast in android?
Answer: Toasts are the simple popup messages which are used to provide feedback about the current operation. Toasts come useful when there is an ongoing process and we want to show the processing message without affecting the current activity and display.
val text = "Sending Text" val toast = Toast.makeText(applicationContext, text,20) toast.show()
Question: What is an Android framework?
Answer: An android framework is a collection of pre-built API’s which allow developers to built robust android application quickly and efficiently. An android framework consists of various tools which include UI designing, and System tools.
Question: What do you know about broadcast receivers?
Answer: Broadcast receivers are used to respond the broadcast messages sent from the other applications or system itself.
An application can receive broadcast via two methods.
- Maifest-declared receivers:
- Context-registered receiver.
BroadcastReceiver br = new MyBroadcastReceiver();
Question: Explain the various important files and folders created during the new app.
- App: It defines all the main characteristics and components fo the application.
- java: This directory contains all the important .java files for the project.
- res: This directory contains the files for app UI(User Interface)
- Gradle Script: It gets auto-generated, and contains files like compileSdkVersion, buildToolsVersion, applicationId, minSdkVersion, targetSdkVersion, versionCode and versionName.
Question: What do know about sticky intent?
Answer: Sticky intents used with the sticky broadcast, and a stick intent stick with the android system for future broadcast receiver request. To perform a sticky intent we use the sendStickyBroadcast() method. It got its name because the intent will stick around even after the broadcast is complete.
Question: What is the difference between an Activity and Fragment?
Activity: Activity can be treated as a signal which deals with operations performed by the user such as dialling a number, clicking a picture, sending mail, etc.
Fragment: It is a modular part of the activity, and it has its own life cycle with input events. And a fragment can be affected by its parent activity.
Question: Why it is recommended not to change the application name after deployment?
Answer: We can change the application name whenever we feel so. However, in the development and deployment process doing so is not recommended because it can affect some of the application functionality which could result in application failure and break.
Question: What is DDMS?
Answer: It is a debugging tool offered by Google SDK, and it stands for Dalvik Debug Monitor Server.
DDMS offers the following features:
- Incoming call and SMS spoofing
- Local data spoofing
- Network traffic tracking
- Thread and heap information
- Screen capture device
Question: List some difference between service and thread.
|It is similar to activity without interface.||It is a concurrent execution of units.|
|A service run at background until it gets stopped explicitly.||Thread run with the same process when the application run.|
|If an application stop executing it is not necessary that service will also stop its execution.||If an Application gets killed then its threads also killed.|
|One application service can be exposed or used by another application.||To use threads google has introduced handler and looper into android threads.|
Question: What do you know about ART?
Answer: Android Runtime aka ART is a runtime environment used by the android application and services. Similarly to its predecessor Dalvik, ART was designed specially for android projects. It is capable of executes the Dalvik Executable format and Dex bytecode specification. ART is well compatible with Dalvik so applications written for Dalvik can also run using ART.
Question: List some importance of using Emulators.
- It helps the developer to play around the application interface, and give an idea about how the application will work on an actual device.
- It helps in debugging, and code testing.
- It provides a proper place for the testing and development phase.
Question: List the states of activity.
Answer: When there is a change in configuration the state of activity change too. The activity gets created and destroyed according to the triggered events.
Here is the list of major activity states:
- Active: When there is an ongoing activity performing.
- Pause: Activity is running at the background and still visible to the user.
- Stooped: When an activity is obscured by another.
- Destroyed: In this state, the activity process is killed.
Question: What is a dialog and name the dialog box supported by Android.
Answer: It is a prompt window which allows the user to enter some additional information. A dailog window does not cover the screen completely, and simply provide a popup small window for decision and input entry.
- AlertDialog: An alert dailog box can have 0 to 3 buttons, which include checkbox and radio buttons.
- processDialog: It is used to the process bar, the brightness controller in android devices is an example of process dialog.
- DatePickerDialog: It is used to prompt up the date window.
- TimePickerDialog: It is an extension of DatePikerDialog, which can be used to select the time.
Question: Name the exceptions that arise in android.
Answer: Exceptions are the errors occur in the program due to some ill-logical code.
- InflateExpection: This exception occurs if there is an error condition.
- Surface.OutOfResourceException: This exception rise if the surface is not created or resized.
- SurfaeHolder.BadSurfaceTypeException: .lockCanvas() method can throw this exception.
- WindowManager.BadTokenException: This exception occurs due to invalid WindowManager.LayoutParamstoken
Question: List the Datatypes supported by AIDL.
- All primitive Java Data types (int, long, char and boolean)
Question: What does orientation do in android?
Answer: Orientation is an activity which is used to represent the layout of a screen display in the form of row and columns.
<activity android name=".activity" android: screenOrientation="landscape">
Question: Do all mobile devices support the latest android version?
Answer: There are some limited mobile devices in the market which support up-gradation to the latest version of the operating system. The main reason why every device does not get the latest version is because of its hardware specification.
Question: Can we add a fragment without a user interface?
Answer: Yes, we can use the method
add(fragment, string) to add a fragment from the activity.
With this, we have reached at the end of our top Android interview questions. We hope you like this article, and you get to know something new. If you have ever been in an Android job interview please comment down the technical questions you faced during the interview, and we try to answer them. We hope these Android questions help you to crack the interview.
If you like this article or have any suggestion, please let us know by commenting down below.
You might be interested in: