Top 100 Android Interview Questions & Answers

Frequently asked Android Interview Questions

Q1. What is Android?

Answer:Android is a popular, open-sourced mobile operating system that is used on mobile, tablets televisions. etc., it provides a rich application framework to executes within its own process and its own instance of Dalvik Virtual Machine (DVM) or Android RunTime (ART). Android programs are written in Java that runs through a Java virtual machine JVM which is optimized for mobile devices.

Q2. What are the languages used to build Android?

Answer:The main language supported to build Android applications is Java programming language which is most popular language for app development that makes it ideal even for new Android developers to quickly learn to create and deploy applications in the Android environment. Eclipse, NetBeans, and IntelliJ IDE are the most popular IDE’s(Integrated Development Environment) used for developing an Android application using java.

Kotlin is a relatively new, modern, safe, and object-oriented cross-platform programming language used in developing an Android application. IDE’s used with kotlin are Android studio, Eclipse IDE, etc.

C#: Developers can build native iOS and Android mobile applications by using the C# language. Visual Studio is the best tool for developing an Android application using C#.

Python is a dynamic and object-oriented programming language that is very popular in machine learning. Pydroid 3, Dcoder, spck code editor is some of the code editors for Python.

Other languages which can be used in Android development are C++, HTML 5. C4droid, CppDroid, AIDE, etc. are IDE’s for C++. Acode, spck code editor, etc. are examples of IDE are used with HTML.

Q3. What is a service?

Answer:Service is an application component that facilitates an application to run in the background in order to perform long-running operations without user interaction. A service can run continuously in the background even if the application is closed or even after the user switches to another application.

Q4. What is an Adapter?

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

Q5. Define Android Architecture?

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

The five layers present in the Android stack are:

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

Q6. What is the use of Bundle ?

Answer: Bundle: - A mapping from String values to various Parcelable types.It is used for passing data between various activities of android. To be used for the destination activity, create a bundle and pass it to Intent that starts the activity. Bundle is generally.

Attend a Free Online Mock Interview

Q7. What is DDMS?

Answer: DDMS stands for Dalvik Debug Monitor Server which is a debugging tool from the Android software development kit. It is able to monitor operations in the emulator as well as real devices, It reports the details of each processing thread and time spent whether in the app or Android OS.

Q8. What Is the Google Android SDK?

Answer: The Google Android SDK is a toolset that developers need in order to write apps on Android enabled devices. It contains a graphical interface that emulates an Android driven handheld environment, allowing them to test and debug their codes.

Q9. Describe Activities?

Answer:Activities are refer to as the window to a user interface. Activities play the same role just as you create windows in order to display output or to ask for an input in the form of dialog boxes, , though it may not always be in the form of a user interface.

Q10. What are the advantages of Android?

Answer:

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

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

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

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

Q11. Define Android toast.?

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

Q12. What are containers?

Answer: Containers hold 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.

Q13. List the various storages that are provided by Android?

Answer: The various storage provided by android are:

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

Q14.What is portable Wi-Fi hotspot?

Answer:Portable Wi-Fi Hotspot permits to share the mobile internet connection with other wireless devices. For example, using the Android phone as a Wi-Fi hotspot, use the laptop to connect to the internet using that access point.

Q15. What are Intents?

Answer: Intents displays notification messages to the user from within the Android enabled device. It can be used to alert the user of a particular state that occurred. Users can be made to respond to intents.

Q16. Differentiate Activities from Services?

Answer:Activities can be closed, or terminated anytime the user wishes. On the other hand, services are designed to run behind the scenes, and can act independently. Most services run continuously, regardless of whether there are certain or no activities being executed.

Q17. What is the importance of XML-based layouts?

Answer: The use of XML-based layouts provides a consistent and somewhat standard means of setting GUI definition format. In common practice, layout details are placed in XML files while other items are placed in source file.

Q18. What is NDK?

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

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

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

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

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

Q20.What is an APK format?

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

Q21. What are the four essential states of an activity?

Answer:

  • 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

Q22. What is the function of an intent filter?

Answer: Because every component needs to indicate which intents they can respond to, intent filters are used to filter out intents that these components are willing to receive. One or more intent filters are possible, depending on the services and activities that is going to make use of it.

Q23. Which types of flags are used to run an application on Android?

Answer: The two types of flags to run an application in Android:

  • FLAG_ACTIVITY_NEW_TASK
  • FLAG_ACTIVITY_CLEAR_TOP

Q24. Name the dialog box which is supported by Android?

Answer:

  • Alert Dialog
  • Progress Dialog
  • Date Picker Dialog
  • Time picker Dialog

Q25. Enumerate the three key loops when monitoring an activity?

Answer:

  • Entire lifetime – activity happens between onCreate and onDestroy
  • Visible lifetime – activity happens between onStart and onStop
  • Foreground lifetime – activity happens between onResume and onPause

Q26. What are the different states wherein a process is based?

Answer:

There are 4 possible states:

  • Foreground activity
  • Visible activity
  • background activity
  • empty process

Q27. What is the AndroidManifest.xml?

Answer: AndroidManifest.xml is essential in every application which is declared in the root directory and contains information about the application that the Android system must know before the codes can be executed.

Q28. What is an action?

Answer: Action is what the intent sender wants to do or expected to get as a response. Most application functionality is based on the intended action.

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

Answer: In general, a Nine-patch image allows resizing that can be used as background or other image size requirements for the target device. The Nine-patch refers to the way you can resize the image: 4 corners that are unscaled, 4 edges that are scaled in 1 axis, and the middle one that can be scaled into both axes.

Q30. Do all mobile phones support the latest Android operating system?

Answer: Some Android-powered phone allows to upgrade to the higher Android operating system version. However, not all upgrades would allow to get the latest version. It depends largely on the capability and specs of the phone, whether it can support the newer features available under the latest Android version.

Q31. What composes a typical Android application project?

Answer:A project under Android development, upon compilation, becomes an .apk file. This apk file format is actually made up of the AndroidManifest.xml file, application code, resource files, and other related files.

Q32. What is the life cycle of Android activity?

Answer:

  • OnCreate(): It is called when activity is created. Using this, the views are created and data is collected from bundles.
  • OnStart(): It is called if the activity is becoming visible to the user. It may be succeeded by onResume() if the activity comes to the foreground, or onStop() if it becomes hidden.
  • OnResume(): It is called when the activity will start an interaction with the user.
  • OnPause(): This is called when the activity is moving to the background but hasn’t been killed yet.
  • OnStop(): This is called when an activity is no longer visible to the user.
  • OnDestroy(): This is called when the activity is finished or destroyed.
  • OnRestart(): This is called after the activity has been stopped, prior to it being started again.

Q33. Explain the dialog boxes supported on Android?

Answer: Android supports four dialog boxes. They are:

AlertDialog: The AlertDialog supports 0-3 buttons, along with a list of selectable items such as checkboxes and radio buttons.
It is used when you want to ask the user about taking a decision between yes or no in response to any particular action taken by the user, by remaining in the same activity and without changing the screen.
DatePickerDialog: It is used for selecting the date by the user.
TimePickerDialog: Used for selecting the time by the user.
ProgressDialog: It is an extension of the AlertDialog and is used to display a progress bar. It also supports the addition of buttons.

Q34.What is a Toast? Write its syntax?

Answer: Toast is a message that pops up on the screen which is used to display the message regarding the status of the operation initiated by the user and covers only the expanse of space required for the message while the user’s recent activity remains visible and interactive.

Toast notification automatically fades in and out and it does not accept interaction events.

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

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

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

Q36. Explain different launch modes in Android?

Answer:The different launch modes in Android are given below:

Standard:
Standard launch mode generates an activity’s new instance in the task from which it originated. It is possible to create several instances for the same activity.
For Example, suppose our current stack is A -> B -> C. Now, if we launch activity B again with the “standard” launch mode, then the new stack will be A -> B -> C -> B.
SingleTop:
SingleTop launch mode is similar to the Standard launch mode except if there exists an activity’s previous instance on the top of the stack, then a new instance will not be created. But the intent will be sent to the activity’s existing instance.
For example, suppose our current stack is A -> B -> C. Now, if we launch the activity B again with “singleTop” launch mode,then the new stack will be A -> B -> C -> B.
SingleTask:
This launch mode will create a new task and push a new instance to the task as the root.
For example, suppose our current stack is A -> B -> C -> D. Now, if we launch activity B again with the “singleTask” launch mode, then the new stack will be A -> B. Here, a callback has been received on the old instance and C and D activities are destroyed.
Single Instance:
This launch mode is similar to the SingleTask launch mode. But the system doesn’t support launching any new activities in the same task.In a situation where the new activity is launched, it is launched in a separate task.
For example, suppose our current stack is A -> B -> C. Now, if we launch the activity D with the “singleInstance” launch mode, then there will be two stacks:
A -> B -> C D, If you call activity E, then it will be added to the first stack. A -> B -> C -> E D
Again if you Call the activity D, then it will call the same activity from the 2nd stack and pass the intent to onNewIntent().

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

Answer: A broadcast receiver is a mechanism used for listening to system-level events like listening for incoming calls, SMS, etc. by the host application. It is implemented as a subclass of BroadcastReceiver class and each message is broadcasted as an intent object. public class MyReceiver extends BroadcastReceiver { public void onReceive(context,intent){} }

Q38. What is the significance of the .dex file?

Answer:Android programs are compiled into a .dex file (Dalvik Executable file) by DVM, which are then zipped into a .apk file on the device. .dex files are created by translating compiled applications written in java. .dex is a format that is optimized for effective storage and memory-mappable executions.

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

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

Sensor class helps to create an instance of a specific sensor which provides methods that let to determine a sensor’s capabilities.

SensorManager class is used to create an instance of the sensor service which provides methods to access and list sensors, to register and unregister sensor listeners, etc.

SensorEvent class is used to create sensor event object thatprovides information about the sensor event including raw sensor data, the accuracy of data, type of sensor, timestamp of event, etc.

SensorEventListener interfaceis used to create two callback methods that receive sensor event notifications when sensor value changes or when sensor accuracy changes. Those two methods are void onAccuracyChanged which is called when sensor accuracy is changed and void onSensorChanged which is called when sensor values are changed.

Q40. What are the differences between Service and Thread?

Answer: Service is an application component that facilities an application to run in the background without user interaction where thread is a concurrent unit of execution. Service exposes few functionalities to other applications and its not killed when an application is killed but the thread is killed when an application is killed .

Q41. What is the difference between Serializable and Parcelable?

Answer: Serializable:

Serializable is a standard Java interface, we can simply mark a class Serializable by implementing the interface and java will automatically serialize it.Reflection is used during the process and many additional objects are created. This leads to plenty of garbage collection and poor performance.

Parcelable:

In this approach, you implement the serialization yourself. Reflection is not used during this process and hence no garbage is created. It is far more efficient than Serializable since it gets around some problems with the default Java serialization scheme. Also, it is faster because it is optimized for usage on the development of Android, and shows better results.

Q42. Mention the difference between class, file and activity in Android?

Answer: Class is a compiled form of a .java file that Android uses to produce an executable .apk file whereas file is a block of arbitrary information or resources used for storing information. It can be of any file type. Activity is a single screen that represents GUI (Graphical User Interface) with which users can interact in order to do something like dial the phone, view email, etc.

Q43. Explain Sensors in Android?

Answer: Android-based devices have a collection of built-in sensors in them, which measure certain parameters like motion, orientation, and many more through their high accuracy. The sensors can be both hardware and software based on nature. There are three prominent categories of sensors in Android devices. They are:

  • Position Sensor is used for measuring the physical position of the Android device. This has orientation sensors and magnetometers.
  • Motion Sensors consist of gravity, rotational activity, and acceleration sensors which measure the rotation of the device or the acceleration, etc.
  • Environmental Sensor includes sensors that measure temperature, humidity, pressure, and other environmental factors.

Q44.What are the features of Android architecture?

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

The five layers present in the Android stack are:

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

Q45. What is an activity?

Answer:Activity in java is a single screen that represents GUI (Graphical User Interface) with which users can interact in order to do something like dial the phone, view email, etc.

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

Q46. Which are the tools placed in Android SDK?

Answer: The tools placed in Android SDK are given below:

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

Q47. What is AAPT?

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

Q48. Explain Sensors in Android?

Answer: Android-based devices have a collection of built-in sensors in them, which measure certain parameters like motion, orientation, and many more through their high accuracy. The sensors can be both hardware and software based on nature. There are three prominent categories of sensors in Android devices. They are:

  • Position Sensor: It is used for measuring the physical position of the Android device. This has orientation sensors and magnetometers.
  • Motion Sensors: These sensors consist of gravity, rotational activity, and acceleration sensors which measure the rotation of the device or the acceleration, etc.
  • Environmental Sensor: It includes sensors that measure temperature, humidity, pressure, and other environmental factors.

Q49. What is AndroidManifest.xml file and why do you need this?

Answer: The AndroidManifest.xml file contains information regarding the application that the Android system must know before the codes can be executed. It is essential in every Android application which is declared in the root directory.

This file performs several tasks such as:

  • Providing a unique name to the java package.
  • Describing various components of the application such as activity, services, and many more.
  • Defining the classes which will implement these components.

Q50. WWhat is intent?

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

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

  • Implicit Intent- Used to invoke the system components.
  • Explicit Intent- Used to invoke the activity class.

Q51. What is the importance of having an emulator within the Android environment?

Answer: Emulators are a safe place for testing codes especially if it is in the early design phase. Developers play around an interface that acts as if it were an actual mobile device and can write, test codes, and even debug.

Q52. What items are important in every Android project?

Answer: The essential items that are present each time an Android project is created are:

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

Q53. What is Orientation?

Answer: Orientation can be set using setOrientation(), dictates if the LinearLayout is represented as a row or as a column. Values are set as either HORIZONTAL or VERTICAL.

Q54. What is the importance of Android in the mobile market?

Answer: Developers can write and register applications that will specifically run under the Android environment. Every mobile device that is android enabled will be able to support and run these apps. With the growing popularity of Android mobile devices, developers can take advantage of this trend by creating and uploading their apps on the Android Market for distribution to anyone who wants to download it.

Q55. Which elements can occur only once and must be present?

Answer:Among the different elements, the “and” elements must be present and can occur only once. The rest are optional, which can occur as many times as needed.

Q56. What is ADB?

Answer: ADB is short form for Android Debug Bridge. That allows developers the power to execute remote shell commands. Its basic function is to allow and control communication towards and from the emulator port.

Q57. When is the onStop() method invoked?

Answer: A call to onStop method happens when an activity is no longer visible to the user, either because another activity has taken over or if in front of that activity.

Q58. How can the ANR be prevented?

Answer: One technique that prevents the Android system from concluding a code that has been responsive for a long period of time is to create a child thread. Within the child thread, most of the actual workings of the codes can be placed, so that the main thread runs with minimal periods of unresponsive times.

Q59. What is the importance of Default Resources?

Answer:When default resources which contain default strings and files are not present, an error will occur and the app will not run. Resources are placed in specially named subdirectories under the project res/ directory.

Q60. What data types are supported by AIDL?

Answer: AIDL has support for the following data types:

  • string
  • charSequence
  • List
  • Map
all native Java data types like int,long, char and Boolean

Q61. What is a visible activity?

Answer: A visible activity is one that sits behind a foreground dialog which is actually visible to the user, but not necessarily being in the foreground itself.

Q62. Is it possible to use or add a fragment without using a user interface?

Answer: Yes, it is possible to do that, such as when we want to create background behaviour for a particular activity. We can do this by using add(Fragment, string) method to add a fragment from the activity.

Q63. What are the core components under the Android application architecture?

Answer: There are 5 key components under the Android application architecture:

  • Services
  • Intent
  • Resource externalization
  • Notifications
  • Content providers

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

Answer:Nine-patch image allows resizing that can be used as background or other image size requirements for the target device. It 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.

Q65. What is an action?

Answer: Action is what the intent sender wants to do or expected to get as a response. Most application functionality is based on the intended action.

Q66. What is a Sticky Intent?

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

Q67. What are the different data storage options available on the Android platform?

Answer: Android platform provides a wide range of data storage options which must be used based on the need such as data is secure and used with permission only or can be accessed publicly.

The list of data storage options on the Android platform are:

  • SharedPreference stores data in XML files which is the simplest way to store private data in the key-value pair
  • SQLite stores structured data in the private database.
  • Internal Storage stores data in the device file system and any other app cannot read this data.
  • External Storage: Data is stored in the file system but it is accessible to all apps in the device

Q68. What is a Sticky Intent?

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

Q69. How do you troubleshoot the android application which is crashing frequently?

Answer: The few steps that we need to follow while troubleshooting the crashing issue are:

  • Free up memory space: There is only limited space available on mobile devices for mobile apps. To avoid crashing issues or memory-related issues, you need to first check the memory space.
  • Clear app data usage: You can clear the app data using the Application Manager under “Settings”. This will clear the cache memory and allow some free space to install another app or it will boost up your current app.
  • Memory Management: Some apps run perfectly on one type of mobile device but the same app may not work on another type of device as for such devices the processing power, memory management, and CPU speed is different. For any app to run properly on any type of mobile device, you should manage the memory on the device.
  • Compatibility issue: It is always not possible to test mobile apps on all mobile devices, browsers, operating systems, etc. So you need to test your mobile app on as many mobile devices as you can in order to avoid any compatibility issue.

Q70. Is it possible to use or add a fragment without using a user interface?

Answer: Yes, it is possible to do that, such as when you want to create background behaviour for a particular activity. You can do this by using add (Fragment, string) method to add a fragment from the activity.

Q71.What is a visible activity?

Answer: A visible activity is one that sits behind a foreground dialog. It is actually visible to the user, but not necessarily being in the foreground itself.

Q72. Is it possible to use or add a fragment without using a user interface?

Answer: Yes, it is possible to do that, such as when you want to create background behaviour for a particular activity. You can do this by using add (Fragment, string) method to add a fragment from the activity.

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

Answer: The methods which almost all subclasses of Activity will implement are:

  • 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.
  • onCreate(Bundle): onPause(): It is a method which deals with the user whenever it leaves the activity. So any changes made by the user should be committed which is done by the ContentProvider that holds the data. 

Q74. What are the different types of intents?

Answer:Types of 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 is when an application defines the target component directly in the intent.

Q75. What are broadcast receivers?

Answer: Broadcast Receiver is a mechanism using which host application can listen for System level events. It is used by the application whenever they need to perform the execution based on system events like listening for Incoming call, sms etc. It 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. 

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

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

  • Manifest file names the Java package for the application 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 which 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.

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

Answer: SQLite is the open-source relational database where 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.

Q78. What is an Android Runtime?

Answer:

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

Q79. What is Dalvik Virtual Machine (DVM)?

Answer: Dalvik is the name of Android’s virtual machine where Dalvik VM is an interpreter-only virtual machine that executes files in the Dalvik Executable (.dex) format. The virtual machine is register-based, 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.

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

Answer: CPI greater than one means over budget, less than one means under budget & equal to one means same as per budget.
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.

Q81. How are escape characters used as attribute?

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

Q82. What are the exceptions in android?

Answer:

  • 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

Q83. What is the difference between Mobile Application Testing and Mobile Testing?

Answer: Mobile application testing is the testing of applications on a device which mainly focuses on functions and features of the application. It is the testing of the actual mobile device and focuses on mobile features like Call, SMS, Contacts, Media Player, inbuilt browsers, etc.

Q84. What is the importance of setting up permission in app development?

Answer:Once the permissions are set for the app development, then the data and code are restricted to the authorized users only. If the code is kept without any restriction or accessible to anyone then there are chances of compromise of code which results in defect leakage.

Q85. What is the database used for the Android platform?

Answer: SQLite is the database that is used for the Android platform which is an open-source, serverless database.

Q86. Which are the dialog boxes supported by the Android platform?

Answer: Android supports four types of dialog boxes:

  • AlertDialog has a maximum of 3 buttons and sometimes AlertDialog includes checkboxes and Radio buttons to select the element.
  • ProgressDialog displays the progress bar or wheels.
  • TimePickerDialog is used to select the Time.
  • DatePickerDialog is used to select the Date.

Q87. What is AIDL?

Answer: AIDL stands for Android Interface Definition Language that facilitates communication between the client and the service. To create and implement the remote methods that facilitate the use of methods from one program to another, the first step is to define the communication interface in AIDL. For communication between processes, the data is broken down into chunks which are easily understandable by the Android platform.

Q88. Which scenario can test only on real devices but not on an emulator?

Answer: Emulators are used for performing similar kinds of testing which is performed on the real devices. It is used as a replacement for real devices as sometimes real devices are not available for testing, the use of real mobile devices for testing purposes is costlier at times.
But there are few scenarios that cannot be tested using emulator, these can be tested only using real devices. These scenarios are interrupted scenarios i.e. message, phone call interruption while using the app, low battery, Bluetooth, memory card mount and unmount, etc.

Q89. Which are the important device characteristics that should be considered when you design and develop an Android application?

Answer:

  • Simple user interface.
  • Few registration fields.
  • Quick response with multiple languages.
  • Think of compactness and work offline
  • 2-click feedback is great.

Q90. Which is the JSON exception in Android?

Answer: JSON exception is thrown to indicate a problem with the JSON API and the problems include: Use of numeric types not available to JSON, such as NaNs or infinities 

Q91. Android is based on which kernel?

Answer: Android uses the Linux kernel because Linux is open-source and developers could modify the Linux kernel to fit their needs. Linux gives the Android developers a pre-built, already maintained operating system kernel to start with so they don't have to write their own kernel.

Q92. What is JobScheduler API?

Answer: The JobSchedular API is used for scheduling different types of jobs against the framework that will be executed in your app’s own process. This allows the application to perform the given task while being considerate of the device’s battery at the cost of timing control.
The JobScheduler supports batch scheduling of jobs. The Android system can combine jobs for reducing battery consumption. JobManager automatically handles the network unreliability so it makes handling uploads easier.

Q93. What is the difference between compileSdkVersion and targetSdkVersion?

Answer: compileSdkVersion:
The compileSdkVersion is the version of API the application is compiled against. Use Android API features involved in that version of the API.
For example, if you try and use API 15 features but set compileSdkVersion to 14, you will get a compilation error. If you set compileSdkVersion to 15 you can still run the app on an API 14 device as long as your app’s execution paths do not attempt to invoke any APIs specific to API 15.
targetSdkVersion: The targetSdkVersion indicates that you have tested your app on the version you specify. This is like a certification or sign-off you are giving the Android OS as a hint to how it should handle your application in terms of OS features.
For example, setting the targetSdkVersion value to “11” or higher permits the system to apply a new default theme (Holo) to the application when running on Android 3.0 or higher. It also disables screen compatibility mode when running on larger screens (because support for API level 11 implicitly supports larger screens.

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

Answer: App: describes the basic characteristics of the application and defines each of its components.
Java: This contains the .java source files and .kt(source code written in Kotlin) source files of your project. By default, it includes a MainActivity.java or MainActivity.kt source file. Create all the activities which have .java and .kt extensions under this file and also it includes all the code behind the application.
Res is used to store the values for the resources that are used in various Android projects to include features of color, styles, dimensions, etc.It is a directory for files like styles.xml, strings.xml, colors.xml, dimens.xml, etc.
A script is an auto-generated file that consists of compileSdkVersion, buildToolsVersion, minSdkVersion, targetSdkVersion, applicationId, versionCode, and versionName. For example, build.gradle is a script file placed in the root project directory, defines build configurations that will be applied to all modules in the project.

Q95. What is context?

Answer: The context is the context of the current state of the application or object. It comes with services like giving access to databases and preferences, resolving resources, and more.
There are two types of context. They are:
Activity context is attached to the lifecycle of an activity. It can be used when you are passing the context in the scope of an activity or you need the context whose lifecycle is attached to the context of the activity.
Application context is attached to the lifecycle of an application.It should be used where you need a context whose lifecycle is separate from the current context or when you are passing a context beyond the scope of activity.

Q96.Name some exceptions in Android?

Answer:

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

Q97.What do you mean by a drawable folder?

Answer: Drawable folder is compiled a visual resource that can use as a background, banners, icons, splash screen, etc.

Q98.What is application Widgets in Android?

Answer: Application widgets are miniature application views that can be embedded in other applications and receive periodic updates. These views are referred to as Widgets in the user interface, and an App Widget provider is used to publish application widgets.

Q99. What is View Group?

Answer: The ViewGroup is the base class for Layouts in android, like LinearLayout , RelativeLayout , FrameLayout etc. It is used to define the layout in which views(widgets) will be set/arranged/listed on the android screen.

Q100.How to call another activity in android?

Answer: Intent i = new Intent(getApplicationContext(), ActivityTwo.class);   startActivity(i);  

WhatsApp-Credo-Systemz