Easy way to IT Job

Android Interview Questions and Answers
Share on your Social Media

Android Interview Questions and Answers

Published On: April 12, 2022

Android Interview Questions and Answers

Android is a widely popular and open-source operating system that grows day by day with innovative technologies and tremendous job opportunities. It is developed by Andy Robin and it is a Linux-based operating system that enables developers to build and deploy apps that perform basic and advanced functions on smartphones, tablets, and televisions. Top companies around the world are looking for Android professionals to develop apps for devices and our Android Interview Questions and Answers for the aspirants to crack the technical rounds easily.

Android Interview Questions and Answers for Freshers

  1. What is Android and explain its scope?

Android is an open-source operating system used on smartphones, televisions, and tablets for running the applications. The Android application executes with its own processes and instances of Dalvik Virtual Machine (DVM) or Android Runtime (ART). The scope of Android is helping smartphone users to download that gives various services. Android developers can develop and publish their apps on various platforms like the Amazon app store, Opera mobile store, SlideME, and Mobango. Some of the platforms are free and they are creating a huge market for Android mobile app development.

  1. What are the components of an Android App?

Android application architecture contains the list of components as follows

  • Service is used to perform background functionalities
  • Activity or Intent is a single screen to represent GUI (Graphical User Interface) that users can interact with to do something like view email or dial the phone.
  • Broadcast Receiver is a mechanism used to listen to system-level events like incoming calls listening or SMS, etc. by the host application.
  • Content provider is the data that has been shared between various applications.
  1. What are the specialized features of Android Architecture?

Android Architecture consists of various layers for the operating system, applications, and middleware. Every layer in the Android architecture provides various services to the layer as follows

Linux Kernel: This is responsible for device drivers, memory management, device management, resource access, and power management.

Libraries: They are a set of reusable libraries that have numerous open-source web browser engines WebKit, play and record audio and video, library libc, SSL libraries for internet security, and SQLite database to share data storage for applications.

Android Runtime: They are core libraries with DVM (Dalvik Virtual Machine) or ART (Android Runtime) that help in the running of an android application. DVM is for mobile devices and it provides fast performance and consumes less memory. ART is used to execute android apps from the Android Lollipop 5.0 version instead of DVM with API level 21.

Android Framework: It contains Android APIs like UI (User Interface), content providers (data), resources, telephony, locations, and package managers. It offers interfaces and classes for the development of Android apps.

Android Applications: Home, Games, Contacts, Settings, etc are the applications that use the Android framework along with Android Runtime and Libraries.

  1. List the advantages of Android OS

Android has the following advantages for developers and users

  • Open-source that requires no license, distribution, or development fee
  • Platform-independent that supports all major platforms like Windows, Linux, Mac, etc.
  • Technology-adaptable that supports various technologies like Bluetooth, Wifi, EDGE, etc.
  • Highly optimized VMs that uses a virtual machine for mobile devices with DVM (Dalvik Virtual Machine)
  1. Define AAPT

AAPT stands for Android Asset Packaging Tool that provides developers with the ability to deal with zip-compatible archives including creating and extracting files as well as viewing files.

  1. What programming languages can be used to develop Android Apps?

The following are the most popular programming languages used in developing applications for Android

  • Java: Android development is using Java Programming Language and the IDEs (Integrated Development Environment) such as Eclipse, IntelliJ, and NetBeans are used to develop applications in Android.
  • Kotlin: It is a safe, cross-platform, and object-oriented programming language for modern app development in Android. IDEs of Kotlin used in android app development are Android Studio, Eclipse IDE, etc.
  • C#: Android mobile applications and native iOS are developed with C# programming language. Visual Studio with C# is the best tool for developing Android Apps.
  • Python: It is a very popular and dynamic programming language based on OOPs concepts and it is used mostly for developing apps with machine learning technology. Pydroid 3, spck code editor and Dcoder are some of the code editors from Python.
  • Other programming languages that can be used in Android Development are C++ and HTML5. AIDE, C4droid, and CppDroid are IDEs of C++ and Acode, spck code editor is IDEs of HTML5.
  1. Describe Google Android SDK with its tools

The Google Android SDK is a toolset used for writing applications by developers on Android-enabled devices and the tools placed in Android SDK are as follows

  • Android Emulator: A software application for simulating android devices for testing apps
  • DDMS (Dalvik Debug Monitoring Services): A debugging tool that provides services like call spoofing, message formation, and screenshot capturing.
  • ADB (Android Debug Bride): A command-line tool used for allowing and controlling communication with the emulator instance.
  • AAPT (Android Asset Packaging Tool): A build tool that provides the ability to view, create, and update zip-compatible archives.
  1. Explain the usage of the emulator of the Android Environment

The emulator in the Android environment allows developers “play” around an interface that serves as actual mobile devices. It helps developers write, test, and debug codes. Emulators are a safe place for testing developed android codes early in the designing phase.

  1. Define Bundle in Android

Bundles are used to send the required data between Android activities and they are like HashMap which takes trivial data types. Following is the sample code to show how to pass the data using the Bundle

Bundle b = new Bundle();

b.putString(“Email”, “[email protected]);

i.putExtras(b); // here, “i” is an intent

  1. Explain Adapter in Android

The adapter in Android serves as a bridge between an AdapterView and the underlying data for the view. It holds the data and passes them to the adapter view and the view will take the data from the adapter view and sends the data on various views like a spinner, grid view, or list view.

  1. Define Portable Wi-Fi Hotspot

The portable Wi-Fi hotspot allows users to share the mobile internet connection with other wireless devices. For instance, using your mobile internet connection for your laptop to connect to the internet using that access point.

  1. Define Android Debug Bridge (ADB)

Android Debug Bridge is a command-line tool used to allow and control communication with an emulator instance and it provides the power for developers to execute remote shell commands to execute applications on an emulator.

  1. Explain DDMS and its features

DDMS stands for Dalvik Debug Monitor Service used in the Android platform as a debugging tool and it provides the following list of debugging features

  • Port forwarding services
  • Thread and heap information
  • Logcat
  • Screen capture on the device
  • Network traffic tracking
  • Incoming calls and SMS spoofing
  • Location data spoofing
  1. Define AIDL

AIDL (Android Interface Definition Language) is a tool that manages the interface requirements between a client and a service for interprocess communication to communicate at the same level. The process includes dividing an object into primitives that are learned by the Android OS and the data types supported by AIDL are String, List, Map, CharSequence, and Java data types such as int, long, char, and Boolean

  1. Explain the various states in a process is based

There are four possible states such as foreground activity, a visible activity, background activity, and empty process.

Android Interview Questions and Answers for Intermediates

  1. Explain the lifecycle of Android Activity

OnCreate() is the method that will be called when an activity is created. The views will be created and the data will be collected from bundles using this OnCreate() method.

OnStart() is the method that will be called if the activity becomes visible to the user and it may be succeeded by OnResume() method. If the activity comes to the foreground, or OnStop() if it becomes hidden.

OnResume() is the method that will be called when the activity will start interacting with the user.

OnPause() is the method that will be called when the activity is moving to the background but not yet killed.

OnStop() is the method that will be called when the activity is no longer visible to the user.

OnDestroy() is the method that will be called when an activity is finished or removed from the list.

OnRestart() is the method that will be called when the activity has been stopped and before it is started again.

  1. What is a Sensor in Android?

The sensor in Android is used to measure the parameters like motion, orientation, and so on through their high accuracy and many Android-based devices will have a collection of built-in sensors. They can be both hardware and software based on nature and there are three primary categories of Sensors in Android Devices. They are,

  • Position Sensor that is used to measure the physical position of the Android device and this has orientation sensors and magnetometers.
  • Motion Sensor consists of gravity, acceleration, and rotational activity sensors for measuring the rotation or the acceleration of the device.
  • Environmental Sensor that includes sensors for measuring temperature, pressure, humidity, and other environmental factors.
  1. List the dialog boxes that are supported on Android

Android supports four dialog boxes namely AlertDialog, DatePickerDialog, TimePickerDialog, and ProgressDialog.

AlertDialog: It supports 0-3 buttons along with a list of selectable items like checkboxes and radio buttons. It is used when the user wants to ask for decision-making between yes or no to any particular action taken by the user by remaining in the same activity and without changing the screen.

DatePickerDialog: It is used to select the date by the user.

TimePickerDialog: It is used to select the time by the user.

ProgressDialog: It is an extension of the AlertDialog used to display a progress bar. It supports the addition of buttons. This class was deprecated in API level 26 as it prevents the user from interacting with the application. We can use a progress indicator like ProgressBar that can be embedded in the user interface of your application.

  1. Explain the AndroidManifest.xml file with its usage

The AndroidManifest.xml consists of information regarding the application that the Android System should know before the codes can be executed. This file is important in each Android app. It is defined in the root directory and this file performs various tasks such as,

  • Offering a unique name to the java package
  • Defining different components of the application like activity, services, and so on.
  • Describing the classes that will implement these components.
  1. Explain Intent and its types

An intent is a messaging object used to request an action from other components of an application and it can also be used to launch an activity, send an email, send SMS, display a message, etc. It displays notification messages to the user from within an Android-enabled device. It notifies the user of a particular state that occurred. There are two types of intents in Android and they are, Implicit Intent which is used to invoke the system components, and Explicit Intent is used to invoke the activity class.

Implicit Intent: It allows the user to define the action he wants to carry out and the Android System will verify which components are registered to manage that particular action according to the intent data. The target component is not declared in the intent. For example,

Intent i = new Intent(ACTION_VIEW, Uri.parse(http://www.softlogicsys.in));

startActivity(i);

Explicit Intent: It is where the user should inform the system about which activity to be managed this intent and the target component is defined in the intent. For example,

Intent i = new Intent(this, Activitytwo.class);

i.putExtra(“Value1”,”This is ActivityTwo”);

i.putExtra(“Value2”,”This value two for ActivityTwo”);

startActivity(i);

  1. Define ANR and explain the measures to be taken to avoid ANR

ANR (Application Not Responding) is a dialog box that displays when the application is not responding to the user’s actions. This dialog box is displayed when the main thread within an application has been unresponsive for a long time due to the following conditions

  • When there is no response to an input event even after 5 seconds
  • When a broadcast receiver has not finished its execution within 10 seconds

Some measures can be taken to avoid ANR as follows

  • An application must perform lengthy database or networking operations in separate threads to avoid ANR
  • Users can lessen pressure from the UI thread by using the IntentService for background task-intensive applications.
  1. Explain the troubleshooting techniques to be followed if an application gets crashed frequently

We can perform the following techniques to handle applications when it gets crashing frequently

Compatibility Check: It is impossible to validate an application for all kinds of devices and operating systems but there might be a possibility for an application that is not compatible with a particular OS.

Memory Management: Some applications run perfectly on one mobile device but get crashed on the other devices. This is where processing power, CPU speed, and memory management will be considered. We can free up memory space for the application to function properly, as there is a limited amount of memory space on mobile devices. We can delete the application’s data if an application is frequently crashing. That will be cleared its cache memory and enable some free space on the device and it leads to boosting the performance of applications.

  1. What are the various launch modes in Android?

The various launch modes of Android are as follows

Standard Mode: It generates an activity’s new instance in the task from which it originated and it is possible to create several instances for the same activity. For example, if our current stack is A –> B –> C, then we should launch activity B again with the “standard” launch mode and then the new stack will be A –> B –> C –> B.

Single Top Mode: This is more or less similar to the Standard mode except for an activity’s previous instance on the top of the stack and then a new instance will not be created. But the intent will be sent to the activity’s existence instance. For example, our current stack is A –> B –> C and if we launch the activity B again with “Single Top” mode, then the new stack will be A –> B –> C –> B.

Single Task Mode: This mode will create a new task and push a new instance to the task at the root. For example, if our current stack is A –> B –> C –> D and now we launch activity B again, then the “Single Task” is launched, it will be like A –> B. As a callback has been received to the old instance, C and D activities will be destroyed.

Single Instance Mode: It is similar to the Single Task mode but the system will not support launching any new activities in the same task. In this situation, where the new activity is launched, it will be a separate task. If our current stack is A –> B –> C, and if we launch “Single Instance” mode, then if the other task comes, it will be A –> B –> C and D separately. If we add E, then E will be in a separate task.

Android Interview Questions and Answers for Experienced

  1. Differentiate Serializable and Parcelable and declare the best approach for Android

The developer needs to transfer data from one activity to another while developing applications. They need to be added to a relative intent object. Some additional actions are to be added to make data suitable for transfer. It will have happened either serializable or parcelable.

Serializable is a standard Java Interface that simply marks a class with it by implementing the interface and java will automatically serialize it. Reflection is used when the process and many additional objects are developed. It leads to garbage collection and poor performance.

Parcelable is an Android-specific interface that we can implement the serialization ourselves. Reflections are not being used while this process and there will be no garbage created. It is far more effective and efficient than serialization as it gets around problems with the default Java serialization scheme. It is faster as it is optimized for usage on the development of Android and displays better results.

  1. Differentiate Service and Thread

Following are the major differences between Service and Thread

  • Service is an application component that facilitates an application to run in the background to perform long-running operations without user interaction while the thread is a concurrent unit of execution.
  • Service exposes few functionalities to other applications by calling Context.bindService() method while Google has brought in handlers and loopers into threads.
  • Service is not killed when an application is killed but the thread will be killed when the application is killed.

Conclusion

Learn the Best Android Course in Chennai at Softlogic to gain expertise with hands-on exposure to Android app development. We hope our Android Interview Questions and Answers given here will be useful for acing the technical rounds of top companies easily. Keep checking our other interview questions and answers here and improve your learning skills efficiently.

Share on your Social Media

Just a minute!

If you have any questions that you did not find answers for, our counsellors are here to answer them. You can get all your queries answered before deciding to join SLA and move your career forward.

We are excited to get started with you

Give us your information and we will arange for a free call (at your convenience) with one of our counsellors. You can get all your queries answered before deciding to join SLA and move your career forward.