This is multi-part series, all focusing on Android interview questions, for both fresher and experienced as well.
Android has the largest installed user base of any mobile platform in the world. As a result, developers who have mastered the OS are in great demand. Of course, when it comes to getting a job, you have to demonstrate your expertise, your passion for the technology and pass a technical interview to win a top paying job. This can be a bit of a challenge as Android has been updated several times since the first version was released, and also because of device fragmentation as each manufacturer tweaks the software.
Let’s look at the following set of interview questions designed for fresher as well as experienced candidates.
What are the advantages of Android?
|Modest & Potent||It is modest and potent SDK (Software Development Kit) and importantly it is open source, meaning that Licensing, Distribution or Development fee is not required.|
|Easy||Easy to Import third party Java library.|
|Multi-platform Support||Android Supports platforms such as Linux, Mac Os, Windows.|
|Useful Products||Ground-breaking products like Location-Aware services, location of a nearby convenience store etc. are quite helpful.|
|Reusable||Components of Android can be reused and replaced by the application framework. Has optimized DVM for mobile devices. SQLite enables to store the data in a structured manner.|
|Technology Support||Android Supports GSM telephone and Bluetooth, WI-Fi, 3G and EDGE technologies. The development is a combination of a device emulator, debugging tools, memory profiling and plug-in for Eclipse IDE.|
What are the different phases of the Activity life cycle?
As an activity transitions from state to state, it is notified of the change by calls to the following protected methods:
- void onCreate(Bundle savedInstanceState)
- void onStart()
- void onRestart()
- void onResume()
- void onPause()
- void onStop()
- void onDestroy()
These seven methods define the entire lifecycle of an activity.
What is an Explicit Intent?
In an explicit intent, the activity that is required to respond to the intent is specified. To be precise, the target components are explicitly designated. This is typically used for application internal messages.
What is an Implicit Intent?
In an implicit intent, only the intent is declared and the activity that can respond to the intent is left to the platform. Here the target component is not declared, hence it is usually used for activating components of other applications as well.
What is an AndroidManifest file?
Applications confirm their components like the .apk file that also holds the application’s code, files, and resources in a manifest file that’s bundled into the Android package. The manifest is a structured XML file and is always named AndroidManifest.xml for all applications. It is also used for naming libraries the application that needs to be linked and identifying any permissions the application expects to be granted.
What’s the difference between a file, a class and an activity in android?
- File – It is a chunk of arbitrary information, or resource for storing information.
- Class – It’s a compiled form of Java file. Android uses the .class files to produce an executable apk
- Activity – An activity is the comparable to a Frame/Window in GUI toolkits. It is not a file or a file type it is just a class that can be extended in Android for loading UI elements on view.
What is the significance of the .dex files?
Android programs are compiled into ‘.dex’ (Dalvik Executable) files, which are zipped into a single .apk file on the device. ‘.dex’ files can be created by translating compiled applications written in Java.
What does ADT stand for?
ADT stands for Android Development Tools. The Android SDK contains several tools and utilities to help create, test and debug your projects.
What are the different tools in Android and explain them?
The Android SDK and Virtual Device Manager:
It is used to create and manage Android Virtual Devices (AVD) and SDK packages. The AVD holds an emulator, letting you specify supported SDK version, screen resolution, SD card storage available and available hardware abilities such as touch screens and GPS.
The Android Emulator:
Android Emulator is an implementation of the Android virtual machine designed to run within a virtual device on the development computer. It is used for testing and debugging Android applications.
Dalvik Debug Monitoring Service (DDMS):
The DDMS is used to monitor and control the Dalvik virtual machines on which the applications are being debugged.
Android Asset Packaging Tool (AAPT):
Builds the distributable Android package files ‘.apk’
Android Debug Bridge(ADB):
Android Debug Bridge is a command-line debugging application distributed along with the SDK. It provides tools to browse the device, copy tools and forward ports for debugging.
What is Dalvik Virtual Machine?
Dalvik is the name of Android’s virtual machine. The Dalvik VM is an interpreter-only virtual machine that executes files in the Dalvik Executable (.dex) format, a format that is optimized for effective storage and memory-mappable executions. The virtual machine is register-based and can run classes compiled by Java language compiler that have been altered into its native format using the included ‘dx’ tool. The VM runs on top of Posix-compliant operating systems depending on it for performing threading and low level memory management functionalities. 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.
What is Android Runtime?
Android comprises of a set of core libraries that provides most of the functionality available in the core libraries of the Java. All Android application runs in its own process, with its own instance of the Dalvik virtual machine. Dalvik has been written in order for the device to run multiple VMs competently. The Dalvik VM executes files in the Dalvik Executable (.dex) format which is boosted for minimal memory footprint. The VM is register-based, and runs classes compiled by a Java language compiler that have been transformed into the ‘.dex’ format by the included ‘dx’ tool.
What is the Open Handset Alliance?
The OHA is a conglomerate of 84 technologies and mobile companies that have joined hands to fast-track innovation in mobile technology and at the same time, offer the end users an improved, cost-effective and richer mobile experience. Members of this alliance include Google, HTC, Sony, Dell, Intel, Motorola, Qualcomm, Texas Instruments, Samsung, LG, T-Mobile, Nvidia. The OHA was started on 5th November, 2007 by Google and 34 other companies. Android is the main software of this alliance.
What is a Service?
A Service is an application component representing either an application’s intent to perform a longer-running operation without interacting with the user or to provide functionality for other applications to use. Services run without a dedicated GUI, but like Activities and Broadcast Receivers, they are executable in the main thread of the application’s process. A Service could be a facility for an application to expose some of its functionality to other applications.
What is the difference between Service and Thread?
Service is like an Activity but has no interface. For example, for fetching information on weather, blank activity will not be created. Here Service will be used. It is also known as Background Service because it performs tasks in background.
A Thread is a concurrent unit of execution. Take note that the UI cannot be updated from a Thread. For this a Handler must be used.
What is a Toast Notification?
Toast notification is a message that pops up on the window. It only covers the expanse of space required for the message and the user’s recent activity remains visible and interactive. The notification automatically fades in and out and does not accept interaction events.
What are the other Notifications?
The other notifications are:
- Status Bar Notification: Used for persistent reminders that originate from the background and request for user’s response.
- Dialog Notification: Used for Activity-related notifications.
What is the significance of XML-based layouts?
XML-based layouts provides consistent and somewhat a standard means of setting GUI definition format. As a general practice, the layout details are placed in XML files, whereas other items are placed in source files.
What are Containers?
Containers hold objects and widgets together, depending on which specific items are needed and in what particular arrangement. Containers may hold labels, fields, buttons, e.t.c
What are the drawbacks of Android?
Android is an open-source platform and at the same time different Operating Systems have been released for different mobile devices. This provides no clear picture on how applications can adapt with different OS versions and upgrades. An app that runs on a particular version of Android OS may or may not run on another.
Another limitation is that, mobile devices comes in different size and forms. Here it becomes a challenge for developers to create apps that can auto-correct to the right screen and other feature of that particular mobile device.
What is ADB?
ADB is abbreviation of Android Debug Bridge. It provides developers the power to execute remote shell commands. Its basic function is to allow and control communication, to and fro from the emulator port.
What are the four essential states of an activity?
- Active – If the Activity is in the foreground.
- Paused – If the Activity is in the background and is still visible.
- Stopped – If the Activity is not visible, therefore is hidden or concealed by another Activity.
- Destroyed – When the Activity process is completed terminated.
What is ANR?
ANR is the acronym for Application Not Responding. This is a dialog that appears to the user whenever an application has been unresponsive for an extended period of time.
How are escape characters used as attribute?
Escape characters when preceded by double backslashes can be used as an attribute. For example, a newline character is created using ‘\\n’
When does other qualifiers in multiple source take precedence over Locale?
This happens at two instances: MCC (mobile country code) and MNC (mobile network code) qualifiers.
What is the correct way of setting up an Android-powered device for app development?
The following are steps need to be followed prior to actual application development in an Android-powered device:
- Declare application as “debuggable” in Android Manifest.
- Turn on “USB Debugging” on your device.
- Set up system to detect your device.
What are the steps involved in creating a bounded service through AIDL?
- Create the ‘.aidl’ file which defines the programming interface
- Implement the interface by extending the inner abstract Stub class as well as embedding its methods.
- Describe the interface by implementing the Service to the clients.
What are the different data types supported by AIDL?
String, CharSequence, List and Map. All built-in Java data types like Int, Long, Char and Boolean are also supported by AIDL
What is a Fragment?
A fragment is a portion of an activity. It is flexible in a sense that it can moved around or combined with other fragments in a single activity. Fragments are also reusable.
Can Fragments be added without using a User Interface?
Yes, this can be done when creating a background behaviour for a particular activity. This can be done by using add (Fragment, string) method to add a fragment from the activity.
How to remove icons and widgets from the main screen of an Android device?
To remove an icon, press and hold that icon. Then drag it towards the lower part of the screen where the remove button appears.
Do all mobile phones support the latest Android Operating System?
Some Android phones lets you to upgrade to higher Operating System version. However, not all upgrades allows you to get the latest version. It depends mainly on whether it can support the newer features available in the latest version.
What is a Portable Wi-Fi Hotspot?
Portable Wi-Fi Hotspots allow you to share your mobile internet connection with other wireless devices. For example, your Android-powered phone can be used as a Wi-Fi Hotspot to make your laptop connect to the internet.
What is the variance between a regular Bitmap and a Nine-Patch image?
A Nine-patch image allows resizing. 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.
What are the exemptions in Android?
- InflateException : When an 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.
Got a question for us? Please mention it in the comments section and we will get back to you.