Generally Asked Android Interview Questions for Freshers

Author: | Posted in Android, Quick Tips No comments

Hello Friends, Some times we need a quick reference to general Android interview questions when we are going for an interview but do not have much time for preparation. Here we have selected some generally asked Android interview questions for you, On which you can have a quick look before your interview.

 

What is android?

Android is a stack of software for mobile devices which has Operating System, middleware and some key applications. The application executes within its own process and its own instance of Dalvik Virtual Machine.
Many Virtual Machines run efficiently by a DVM device. DVM executes Java language byte code which later transforms into .dex format files.

What are the advantages of Android?

The following are the advantages of Android:

* The customer will be benefited from wide range of mobile applications to choose, since the monopoly of
wireless carriers like AT&T and Orange will be broken by Google Android.

* Features like weather details, live RSS feeds, opening screen, icon on the opening screen can be customized

* Innovative products like the location-aware services, location of a nearby convenience store etc., are some of
the additive facilities in Android.
Components can be reused and replaced by the application framework.

* Optimized DVM for mobile devices

* SQLite enables to store the data in a structured manner.

* Supports GSM telephone and Bluetooth, WiFi, 3G and EDGE technologies

* The development is a combination of a device emulator, debugging tools, memory profiling and plug-in for
Eclipse IDE.

Explain about the exceptions of Android?

The following are the exceptions that are supported by Android

* InflateException : When an error conditions are occurred, this exception is thrown

* Surface.OutOfResourceException: When a surface is not created or resized, this exception is thrown

* SurfaceHolder.BadSurfaceTypeException: This exception is thrown from the lockCanvas() method, when
invoked on a Surface whose is SURFACE_TYPE_PUSH_BUFFERS

* WindowManager.BadTokenException: This exception is thrown at the time of trying to add view an invalid
WindowManager.LayoutParamstoken.

Describe the APK format.

The APK file is compressed the AndroidManifest.xml file, application code (.dex files), resource files, and other files. A project is compiled into a single .apk file.

Explain the Architecture of Android ?

Top -> Applications (Contacts, Browser, Phone, etc)
Below Applications -> Application Framework(Activity Manager, Window Manager, Content Providers, View System, Package manager,Telephony manager, Resource, Notification, Location managers) Below Application Framework -> System Libraries(Like Sqlite, webkit, SSL, OpenGL, Media Framework etc) & Android Runtime( Core Libraries and DVM).

What is an activity?

A single screen in an application, with supporting Java code.
An activity presents a visual user interface for one focused endeavor the user can undertake.

What is a service?

A service doesn’t have a visual user interface, but rather runs in the background for an indefinite period of
time.

Describe Android Application Architecture?

Android Application Architecture has the following components:

• Services – like N

• Intent – To perform inter-communication network Operation between activities or services

• Resource Externalization – such as strings and graphics

• Notification signaling users – light, sound, icon, notification, dialog etc

What is an Intent?

A class (Intent) which describes what a caller desires to do. The caller will send this intent to Android’s intent
resolver, which finds the most suitable activity for the intent. E.g. opening a PDF document is an intent, and the Adobe Reader apps will be the perfect activity for that intent (class).

What is a Sticky Intent?

Sticky Intent is also a type of Intent which allows a communication between a function and a service sendStickyBroadcast() performs a sendBroadcast(Intent) known as sticky, i.e. the Intent you are sending stays around after the broadcast is complete, so that others can quickly retrieve that data through the return value of registerReceiver(BroadcastReceiver, IntentFilter). In all other ways, this behaves the same as sendBroadcast(Intent). One example of a sticky broadcast sent via the operating system is ACTION_BATTERY_CHANGED. When you call registerReceiver() for that action — even with a null BroadcastReceiver — you get the Intent that was last broadcast for that action. Hence, you can use this to find the state of the battery without necessarily registering for all future state changes in the battery.

What is Drawable?

A compiled visual resource that can be used as a background, title, or other part of the screen. It is compiled into an     android.graphics.drawable subclass.

How many ways data stored in Android?

Android provides several options for you to save persistent application data. The solution you choose depends on your specific needs, such as whether the data should be private to your application or accessible to other applications (and the user) and how much space your data requires.

Your data storage options are the following:

Shared Preferences : Store private primitive data in key-value pairs.

Internal Storage : Store private data on the device memory.

External Storage : Store public data on the shared external storage.

SQLite Databases : Store structured data in a private database.

Network Connection : Store data on the web with your own network server.
Android provides a way for you to expose even your private data to other applications — with a content provider. A content provider is an optional component that exposes read/write access to your application data, subject to whatever restrictions you want to impose.

Types of Android applications?

1.Foreground

2.Background

3.Intermittent

4.Widget

What are Native Android Actions?

Native Android applications also use Intents to launch Activities and sub Activities

ACTION-ANSWER Opens an Activity that handles immediately initiates a call using the number supplied in the Intent URI. Genereally it’s considered better from to use ACTION_DIAL if possible.

ACTION_DELETE Starts an Activity hat lets you delete the data specified at that Intent’s data URI.

ACTION_DIAL Brings up a dialer application with the number to dial pre-populated from the Intent URI. By
default this is handled by the native Android phone dialer.

ACTION_EDIT Requests an Activity that can edit that data at the specified Intent URI.

ACTION_INSERT

ACTION_PICK

ACTION_SEARCH

ACTION_SENDTO

ACTION_SEND

ACTION_VIEW

ACTION_WEB_SEARCH

What is Pending Intent?

The PendingIntent class provides a mechanism for creating Intents that can be fired by another application at a later time. A pending Intent is commonly used to package an Intent will be fired in response to a future event,such as a widget View being clicked or a Notification being selected from the notification panel.

What is App Widget?

App Widgets are miniature application views that can be embedded in other applications (such as the Home screen) and receive periodic updates. These views are referred to as Widgets in the user interface, and you can publish one with an App Widget provider. An application component that is able to hold other App Widgets is called an App Widget host

Explain AndroidManifest.xml

Every application must have an AndroidManifest.xml file (with precisely that name) in its root directory. The manifest presents essential information about the application to the Android system, information the system must have before it can run any of the application’s code. Among other things, the manifest does the following:

It names the Java package for the application. The package name serves as a unique identifier for the application.

It describes the components of the application — the activities, services, broadcast receivers, and content providers that the application is composed of. It names the classes that implement each of the components and publishes their capabilities (for example, which Intent messages they can handle). These declarations let the Android system know what the components are and under what conditions they can be launched.

It determines which processes will host application components.

It declares which permissions the application must have in order to access protected parts of the API and interact with other applications.
It also declares the permissions that others are required to have in order to interact with the application’s components.

It lists the Instrumentation classes that provide profiling and other information as the application is running. These declarations are present in the manifest only while the application is being developed and tested; they’re removed before the application is published.

It declares the minimum level of the Android API that the application requires.

It lists the libraries that the application must be linked against.

What are Input Events?

On Android, there’s more than one way to intercept the events from a user’s interaction with your application. When considering events within your user interface, the approach is to capture the events from the specific View object that the user interacts with. The View class provides the means to do so.

Within the various View classes that you’ll use to compose your layout, you may notice several public callback methods that look useful for UI events. These methods are called by the Android framework when the respective action occurs on that object. For instance, when a View (such as a Button) is touched, the onTouchEvent() method is called on that object. However, in order to intercept this, you must extend the class and override the method. However, extending every View object in order to handle such an event would not be practical. This is why the View class also contains a collection of nested interfaces with callbacks that you can much more easily define. These interfaces, called event listeners, are your ticket to capturing the user interaction with your UI.

While you will more commonly use the event listeners to listen for user interaction, there may come a time when you do want to extend a View class, in order to build a custom component. Perhaps you want to extend the Button class to make something more fancy. In this case, you’ll be able to define the default event behaviors for your class using the class event handlers.

What is Toast?

A toast provides simple feedback about an operation in a small popup. It only fills the amount of space required for the message and the current activity remains visible and interactive. For example, navigating away from an email before you send it triggers a “Draft saved” toast to let you know that you can continue editing later. Toasts automatically disappear after a timeout.

What is Notification?

A notification is a message you can display to the user outside of your application’s normal UI. When you tell the system to issue a notification, it first appears as an icon in the notification area. To see the details of the notification, the user opens the notification drawer. Both the notification area and the notification drawer are system-controlled areas that the user can view at any time.

What is Linear Layout?

LinearLayout is a view group that aligns all children in a single direction, vertically or horizontally. You can specify the layout direction with the android:orientation attribute.

All children of a LinearLayout are stacked one after the other, so a vertical list will only have one child per row, no matter how wide they are, and a horizontal list will only be one row high (the height of the tallest child, plus padding). A LinearLayout respects margins between children and the gravity (right, center, or left alignment) of each child.

What is Relative Layout?

RelativeLayout is a view group that displays child views in relative positions. The position of each view can be specified as relative to sibling elements (such as to the left-of or below another view) or in positions relative to the parent RelativeLayout area (such as aligned to the bottom, left of center).

A RelativeLayout is a very powerful utility for designing a user interface because it can eliminate nested view groups and keep your layout hierarchy flat, which improves performance. If you find yourself using several nested LinearLayout groups, you may be able to replace them with a single RelativeLayout.

What is GridView?

GridView is a ViewGroup that displays items in a two-dimensional, scrollable grid. The grid items are automatically inserted to the layout using a ListAdapter.

What is ListView?

ListView is a view group that displays a list of scrollable items. The list items are automatically inserted to the list using an Adapter that pulls content from a source such as an array or database query and converts each item result into a view that’s placed into the list.

For an introduction to how you can dynamically insert views using an adapter, read Building Layouts with an Adapter.

What is NFC ?

Near Field Communication (NFC) is a set of short-range wireless technologies, typically requiring a distance of 4cm or less to initiate a connection. NFC allows you to share small payloads of data between an NFC tag and an Android-powered device, or between two Android-powered devices.

Tags can range in complexity. Simple tags offer just read and write semantics, sometimes with one-time-programmable areas to make the card read-only. More complex tags offer math operations, and have cryptographic hardware to authenticate access to a sector. The most sophisticated tags contain operating environments, allowing complex interactions with code executing on the tag. The data stored in the tag can also be written in a variety of formats, but many of the Android framework APIs are based around a NFC Forum standard called NDEF (NFC Data Exchange Format).

What is SIP ?

Android provides an API that supports the Session Initiation Protocol (SIP). This lets you add SIP-based internet telephony features to your applications. Android includes a full SIP protocol stack and integrated call management services that let applications easily set up outgoing and incoming voice calls, without having to manage sessions, transport-level communication, or audio record or playback directly.

Here are examples of the types of applications that might use the SIP API:

Video conferencing.
Instant messaging.

Explain About Sensors.

Most Android-powered devices have built-in sensors that measure motion, orientation, and various environmental conditions. These sensors are capable of providing raw data with high precision and accuracy, and are useful if you want to monitor three-dimensional device movement or positioning, or you want to monitor changes in the ambient environment near a device. For example, a game might track readings from a device’s gravity sensor to infer complex user gestures and motions, such as tilt, shake, rotation, or swing. Likewise, a weather application might use a device’s temperature sensor and humidity sensor to calculate and report the dewpoint, or a travel application might use the geomagnetic field sensor and accelerometer to report a compass bearing.

The Android platform supports three broad categories of sensors:

Motion sensors :
These sensors measure acceleration forces and rotational forces along three axes. This category includes accelerometers, gravity sensors, gyroscopes, and rotational vector sensors.

Environmental sensors :
These sensors measure various environmental parameters, such as ambient air temperature and pressure, illumination, and humidity. This category includes barometers, photometers, and thermometers.

Position sensors :
These sensors measure the physical position of a device. This category includes orientation sensors and magnetometers.
You can access sensors available on the device and acquire raw sensor data by using the Android sensor framework. The sensor framework provides several classes and interfaces that help you perform a wide variety of sensor-related tasks. For example, you can use the sensor framework to do the following:

Determine which sensors are available on a device.

Determine an individual sensor’s capabilities, such as its maximum range, manufacturer, power requirements, and resolution.

Acquire raw sensor data and define the minimum rate at which you acquire sensor data.

Register and unregister sensor event listeners that monitor sensor changes.

What are Intent Objects?

An Intent object is a bundle of information. It contains information of interest to the component that receives the intent (such as the action to be taken and the data to act on) plus information of interest to the Android system (such as the category of component that should handle the intent and instructions on how to launch a target activity). Principally, it can contain the following:

What are Content Providers?

Content providers manage access to a structured set of data. They encapsulate the data, and provide mechanisms for defining data security. Content providers are the standard interface that connects data in one process with code running in another process.

When you want to access data in a content provider, you use the ContentResolver object in your application’s Context to communicate with the provider as a client. The ContentResolver object communicates with the provider object, an instance of a class that implements ContentProvider. The provider object receives data requests from clients, performs the requested action, and returns the results.

You don’t need to develop your own provider if you don’t intend to share your data with other applications. However, you do need your own provider to provide custom search suggestions in your own application. You also need your own provider if you want to copy and paste complex data or files from your application to other applications.

Android itself includes content providers that manage data such as audio, video, images, and personal contact information. You can see some of them listed in the reference documentation for the android.provider package. With some restrictions, these providers are accessible to any Android application.

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:

1) void onCreate(Bundle savedInstanceState)
2) void onStart()
3) void onRestart()
4) void onResume()
5) void onPause()
6) void onStop()
7) void onDestroy()

Taken together, these seven methods define the entire lifecycle of an activity.

 

Note: We have selected these questions and there answers from web. We have no responsibility over their correctness. Some references are below www.stackoverflow.com, www.google.com, Please let us know using comments below or our contact information if any questions belongs to you we will add your reference here also.

(Visited 201 times, 1 visits today)