Android interview questions
In the year 2008 Android came as a popular computing platform, which is based on Linux operating system. In the smartphone market, it became one of the most leading names that managed to change the whole. In last ten years time, it grabs the majority of market share sharing with iOS and has effectively become the world most popular operating system. With the maturity of Android, it is finding its new way into a variety of devices, not just on smartphones but also includes televisions, projectors, automobiles and even now the vehicles. Today with the advent of Android platform, the Android developers are huge in demand and every sector and industry is looking to recruit them in-house. If you aspire to be an Android developer, then this is just the place for you.
Given below is the list of questions, which answers both basic and advanced concepts of Android. These questions if well prepared before an interview shall give an extra edge to the candidate and give confidence of facing the panel:
What is Android?
Android is an open-sourced operating system by Linux that is primarily used in mobile devices like cell phones and tablets. This Linux kernel based system is equipped with high and advanced components that allow developers to create and run apps. Therefore performs the basic as well as the advanced functions.
What are the Android application components?
Android application components are the building block essentially used in the Android application. The application manifest file named Android manifest.xml couples the components. This describes each component of the application and describes how they interact, and then the processing activity takes place.
There are four main components, which are:
- Activities: They show the UI and handle the interaction of the users in smartphone screen.
- Services: They take care of the processing associated with the application.
- Broadcast Receivers: They handle the communication process between Android OS and application.
- Content Providers: They handle issues with data and database management.
What does Fragment mean?
A fragment means behavior or the portion of user interface in a Fragment Activity. One can combine multiple fragments in a single activity to build a UI and can reuse the fragment in multiple activities. The fragment can be considered as a modular section of an activity. This has its life cycle, gets its input events, which can be added or removed accordingly. It is must host a fragment in an activity and fragments lifecycle is directly related by the host activity’s lifecycle.
What options do the users get to save data in Android?
Android provides some options to save or store the app data. Here the choice depends on the specific needs and requirement of space by the users.
Few of the data storage options available on Android are as follows:
- Internal file storage: stores the private file on the device file system.
- External file storage: stores the file on the shared external file system.
- Shared preferences: stores the private primitive data in key-value pairs.
- Databases: stores the structured data in a private database.
To expose one app’s data to other apps, the content provider can be used.
What is AIDL?
AIDL is Android Interface Definition Language. This IDL allows the user to define the programming interface; both the clients and service agree upon to communicate with each other using inter-process communication (IPC). On Android platform, it becomes difficult for one processor to access the memory of another process. They need to decompose their objects into primitive that the operating system can manage, and marshal the objects across. The code to perform that marshaling is tedious to write therefore Android handles this for the users with the help of AIDL
What are services in Android and what is its type?
Services here is an application component that can perform long-duration operations in the background. It doesn’t provide a user interface. Other application components can start a service and can continue to perform/ run in the background when the users switch to some other application. There are three different types of services:
- Foreground: The activity of performing the operation in foreground service is noticeable to the users. A notification is displayed for the same.
- Background: Generally, a background service performs its operations, which is directed not noticed by the users on their screen. Example if an app uses service to compact its storage this will be considered as background service.
- Bound: A service is bound when an application component binds to it by calling it as bind service. A bound service runs only as long as another application component is bound to it.
What is the use of Android manifest.xml?
Every application should have an Androidmanifest.xml file at the root of the project source set. This file describes the essential information required by the user for the app to the Android build tools. Apart from this, it is required for the following reasons:
- To give permission that the application requires to ensure the access is protected.
- To provide with the hardware and software features, which the app requires when installing from Google play etc.
What are launch modes?
It is an instruction for Android OS that specifies how the activity should be launched or performed. The activities are performed into two areas, which are:
- Tasks: It’s a collection of activities, with which the users interact when they perform certain jobs. An application contains a number of activities.
- Back Stack: Back stack in a back stack the activities are arranged with the order in which each is opened. This maintained stack called back stack.
Explain sticky intent?
Sticky intent sticks with the Android for future broadcast listeners. For instance, if Battery low event occurs then that intent will be stick with Android, so that if any future user requested for Battery – Low, it will be fired.
What is the difference between Serializable and parseable?
Serializable is a standard Java interface. It is not a part of the Android SDK. Its simplicity is its biggest beauty. Just by implementing this interface the POJO will be ready to jump from one particular activity to another. There is another interface known as parseable. It is a part of the Android SDK. Paracelable was specifically designed in a way that there is no reflection left while using.
Give a brief idea about Android application architecture?
The architecture of Android application has few components, which have their functions to perform:
- Service: It performs the background functions
- Intent: Performs the interconnection function between activities and data passing mechanism
- Resource: Externalization it is used to perform strings and graphics functions
- Notification: This shows the lights, sound, icon, notification, incoming chats messages dialogue box, etc.
- Content providers: It shares the data between applications.
State the code names of Android along with the year when they were brought in?
Following are the code names with year:
- Cupcake (April 2009)
- Doughnut (September 2009)
- Eclair (October 2009)
- Froyo (may 2010)
- Gingerbread (December 2010)
- Honeycomb (February 2011)
- Ice Cream Sandwich (October 2011)
- Jellybean (July 2012)
- Kitkat (October 2013)
- Lollipop (November 2014)
- Marshmallow (since October 2015)
State the advantages of Android?
Advantages of Android are as follows:
- It is an Open source that requires no licensing
- It is Platform independent that supports Windows, Mac, and Linux platforms.
- Supports different technologies like camera, Bluetooth, wifi, speech, EDGE, etc.
- It is a highly optimized virtual machine.
What are the other languages that Android supports other than JAVA?
Android supports C++, C. The app can be developed in C or C++ using Android NDK (Native development kit). This makes system works faster.
State the life cycle methods of Android activities?
There are seven lifecycle methods of Android activities. They are:
- On create()
- On start()
- On resume()
- On pause()
- On stop()
- On restart()
- On destroy()
What is DDMS?
DDMS is Dalvik Debug Monitor Server.This gives a wide array of debugging features of which are
- Port forwarding services
- Screen capture
- Thread and heap information
- Network traffic tracking
- Location data
what dialogue boxes are supported by the Android box?
Dialogue box supported by Android are:
- Alert dialogue
- Process dialogue
- Data picker dialogue
- Time picker dialogue
What are few exceptions in Android?
These are the following exceptions in Android:
- Inflate exception
- Surface.out of resource exception
- Surface holder bad surface type exception
- Window manager took exception.
What are the tools used to develop an Android app?
Tools used to develop an Android app are as follows:
- Eclipse +ADT Plugin
- SDK Tools
What is meant by Google Android SDK?
The Google Android SDK is a set of tools that are used by the developers to write the app on Android-enabled devices. It contains a graphical interface that emulates an Android-driven handheld environment and allows the developers to debug their codes as per the requirements.
State the difference between a regular bitmap and nine- patch image?
A nine- patch image allows the resizing of the image that can be used as background or other image size requirements for the target device. The nine- patch refers to the way one can resize the image. It can be done in the in the following manners
- 4-image corner unscaled one.
- Four edges, scaled in 1 axis
- The last middle one that can be scaled into both the axes.
What is portable Wi-Fi hotspot?
Portable Wi-Fi hotspot allows the users to share a mobile Internet connection with another device. Using an Android powered phone as a Wi-Fi hotspot user can use their laptop to connect to the Internet using the same access point.
State the importance of XML- based layouts?
XML based layouts provide a consistent and standard means of setting GUI format. In general use, layout details are placed in XML files, and all other items are generally placed in a source files.
Orientation is set using set orientation (), dictates whether the linear layout is represented as a row or else as a column. There the values are set as HORIZONTAL or VERTICAL.
Differentiate between activities and services.
Activities can be closed or can be terminated easily as and when the user wants to. Services are designed to run on the background or behind the scenes and can act independently. Most of the services run on a continuous basis regardless of their certain or no certain activities been executed.
State the importance of having an emulator with the Android environment?
The emulator lets the developers “play” all around the interface that gives the experience of an actual mobile device. It is for writing and testing codes, and debug too. Emulators are safe for testing codes especially if the user is in the early stage of design.
What is the importance of settings permission in app development?
Permission allows certain restrictions to be imposed primarily to protect data and code. Without this, codes could be compromised, resulting in defects in the actual function.
What is AAPT?
AAPT is Android Asset packing tool. This provides developers with the ability to deal with zip-compatible archives, and it includes creating, extracting as well as viewing its content.
State few disadvantages of Android in the mobile market.
Few of the disadvantages of Android in the mobile market are as follows:
- Developers can write and register apps that will only run under the Android environment.
- With the growing popularity and demand for the Android mobile devices, developers can easily take advantage of this trend by uploading the app on the market for the distribution purpose, and people can download it.
What are the four essential states of an activity?
The four initial stages of the activity are as followed:
- Active: If the activity is in the foreground that means it is running on the device.
- Paused: When the activity is at the background and is still visible on the screen.
- Stopped: when the activity is not visible and is actually hidden by another activity that is running on the device.
- Destroyed: when the activation process is killed or is terminated, it’s considered to be completely destroyed.
What is meant by activities?
Activities are windows to an interface. Like a window is created with the aim to display the output and to know about input in the form of a dialogue box. In the same manner, activities play its role, may not always in the form of a user interface.
Intents help to display the notification message to the user from within the Android device. Users are made to response this alert.
List few items, which you think may be important in every Android project?
The important items for Android projects are:
What are containers?
In a general term, the container means some object that can be used to hold or to procure. In a similar manner here, containers are used to hold objects and the widgets altogether.It depends on which specific item is it required and what kind of arrangement is needed. It can be used to hold labels, fields or buttons.
What role has Dalvik played in Android development?
Dalvik plays an important role in the development of Android. It acts as a virtual machine where the Android application runs. It is with the help of Dalvik only that devices can execute multiple virtual machines effectively along with better memory management.
Explain the steps in creating a bounded service through AIDL.
Follow the below steps to create a bounded service through AIDL
- Step 1. Create the .aidl file that defines the programming interface.
- Step 2. Implement the interface, by extending the inner abstract stub class and imparting its methods.
- Step 3. Expose the interface by implementing the service to the users.
State the importance of default resources.
Default resources contain the default string and files. If this resource is not present the error will keep occurring, and the app will not be able to run. Resources are placed in subdirectories under the project res/ directory. Moreover, therefore helps the app to function in the desired conditions.
Fragments are reusable in nature and is a portion of an activity. In other words, it is modular that can be combined or is movable in an activity.
When is it desirable to kill the foreground activity?
Terminating or killing the foreground activity is the last and final savior. It is generally desirable or is the best time to kill this activity when it is consuming too much of memory. When the memory paging state is reached by the activity, it is killed so that the interface can sustain the responsiveness of the user of the application.
What is sticky intent?
It is broadcast from sendstickybroadcasr() method. This allows the intent to float even after the broadcast and allowing others to collect data from.
Is the latest Android operating system supported in all mobile phones?
The supporting facility of Android new version depends on the capabilities and specs of the phone. There are few Android power phones that allow the user to update their version to the higher operating version. Few don’t allow getting the updated version work. Either the new feature will not be supported, or the performance of the operating device will slow down.
What is a marshmallow in Android?
In the latest update of Android version 6.0, the official Android code name is known as a marshmallow. It was launched in May 2015. This was the successor of the Android version 5.0 named as Lollipop. Google named this version as a marshmallow on 17th August 2015 for Nexus devices.