Saturday, May 18, 2013

Android interview Q n A


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:

1 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.
2 Features like weather details, live RSS feeds, opening screen, icon on the opening screen can be customized.
3 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.
a Optimized DVM for mobile devices.
b SQLite enables to store the data in a structured manner.
c Supports GSM telephone and Bluetooth, WiFi, 3G and EDGE technologies.
d The development is a combination of a device emulator, debugging tools, memory profiling and plug-in for Eclipse IDE.


Introduction Android:

Android is an operating system for mobile devices that includes middleware and key applications, and uses a modified version of the Linux kernel. It was initially developed by Android Inc..It allows developers to write managed code in the Java language, controlling the device via Google-developed Java libraries…..

The Android SDK includes a comprehensive set of development tools . These include a debugger, libraries, a handset emulator (based on QEMU), documentation, sample code, and tutorials. Currently supported development platforms include x86-architecture computers running Linux (any modern desktop Linux distribution), Mac OS X 10.4.8 or later, Windows XP or Vista.
Android does not use established Java standards, i.e. Java SE and ME. 

This prevents compatibility among Java applications written for those platforms and those for the Android platform. Android only reuses the Java language syntax, but does not provide the full-class libraries and APIs bundled with Java SE or ME.



Explain about the exceptions of Android?
The following are the exceptions that are supported by Android

a )InflateException : When an error conditions are occurred, this exception is thrown.

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

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

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

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.
For example, a service might play background music as the user attends to other matters, or it might fetch data over the network or calculate something and provide the result to activities that need it.Each service extends the Service base class.


What is an activity?

An activity is a single, focused thing that the user can do. Almost all activities interact with the user, so the Activity class takes care of creating a window for you in which you can place your UI with setContentView(View). 
For example, an activity might present a list of menu items users can choose from or it might display photographs along with their captions.

What is an Application ?

Collection of one or more activities, services, listeners, and intent receivers. An application has a single manifest, and is compiled into a single .apk file on the device.

What is 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.

What is .apk extension?
The extension for an Android package file, which typically contains all of the files related to a single Android 
application. The file itself is a compressed collection of an AndroidManifest.xml file, application code (.dex 
files), resource files, and other files. A project is compiled into a single .apk file.

What is .dex extension?
Android programs are compiled into .dex (Dalvik Executable) files, which are in turn zipped into a single .apk file on the device. .dex files can be created by automatically translating compiled applications written in 

the Java programming language.



What is a Content Provider ?
A. A class built on ContentProvider that handles content query strings of a specific format to return data in a specific format. See Reading and writing data to a content provider for information on using content providers.

 What is a Dalvik ?
 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 efficient storage and memory mappable execution. The virtual machine is register-based, and it can run classes compiled by a Java language 

compiler that have been transformed into its native format using the included “dx” tool. The VM runs on top of 


Posix-compliant operating systems, which it relies on for underlying functionality (such as threading and low 



level memory management). The Dalvik core class library is intended to provide a familiar development base 

for those used to programming with Java Standard Edition, but it is geared specifically to the needs of a small mobile device.



What is an DDMS ?

A. Dalvik Debug Monitor Service, a GUI debugging application shipped with the SDK. It provides screen capture, log dump, and process examination capabilities.

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?
1.SharedPreferences
2.Internal Storage
3.External Storage
4.SQLite Database
5.Network connection

Types of Android applications?
1.Foreground
2.Background
3.Intermittent
4.Widget

Android Development Tools?
The Android SDK and Virtual Device Manager Used to create and manage Android Virtual Devices (AVD) and SDK packages.


The Android Emulator An implementation of the Android virtual machine designed to run within a virtual device on your development computer. Use the emulator to test and debug your Android applications. Dalvik Debug Monitoring Service(DDMS)  Use the DDMS perspective to monitor and control the Dalvik virtual machines on which your debugging your application.


Android Asset Packaging Tool(AAPT) Constructs the destributable Android packages files (.apk).
Android Debug Bridge(ADB) A client-server application that provedes a link to a running emulator.It lets you copy files, install compiled application packages(.apk),and run shell commands.


What is View in Android?
Views are the base class for all visual interface elements(commonly known as controls or widgets). 
All UI controls,including the layout classes,are derived for View.

What View Group in Android?

A. View Groups are extensions of the View class that can contain multiple child View.Extend the ViewGroupclass to create compound controls made up of interconnected child Views.



Some more Gigs about Android.


How will you record a phone call in Android? How to get a handle on Audio Stream for a call in 
Android?
A. Permissions.PROCESS_OUTGOING_CALLS: Allows an application to monitor, modify, or abort outgoing calls.

Why cannot you run standard Java bytecode on Android?
A. Android uses Dalvik Virtual Machine (DVM) which requires a special bytecode. We need to convert Java class files into Dalvik Executable files using an Android tool called "dx". In normal circumstances, developers will not be using this tool directly and build tools will care for the generation of DVM compatible files.

Can you deploy executable JARs on Android? Which packaging is supported by Android?
A. No. Android platform does not support JAR deployments. Applications are packed into Android Package (.apk) using Android Asset Packaging Tool (aapt) and then deployed on to Android platform. Google provides Android Development Tools for Eclipse that can be used to generate Android Package.

Android application can only be programmed in Java?
 False. You can program Android apps in C/C++ using NDK .

What is an action?
The Intent Sender desires something or doing some task.

When does Android start and end an application process?
 Android starts an application process when application's component needs to be executed. It then closes the process when it's no longer needed (garbage collection).

How can two Android applications share same Linux user ID and share same VM?
The applications must sign with the same certificate in order to share same Linux user ID and share same 
VM.