Android Interview Questions and Answers Set 1

1.What is Android?

Android is a Software for mobile devices which includes an 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 languages byte code which later transforms into .dex format files.

2.Why cannot you run standard Java bytecode on Android?

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.

3.What are the different data types used by Android?

The data can be passed between many services and activities using the following data types:

Primitive Data Types: This is used to share the activities and services of an application by using the command as Intent.putExtras(). This primitive data passes the command to show the persistent data using the storage mechanism. These are inbuilt data types that are used with the program. They provide simple implementation of the type and easy to use commands.

Non-Persistent Objects: It is used to share complex and non-persistent objects. These are user-defined data types that are used for short duration and are also recommended to be used. These types of objects allow the data to be unique but it creates a complex system and increase the delay.

4.What needs to be done in order to set Android development environment where Eclipse IDE is to be used?

Download the Android SDK from Android homepage and set the SDK in the preferences. Windows > Preferences > Select Android and enter the installation path of the Android SDK. Alternatively you may use Eclipse update manager to install all available plugins for the Android Development Tools (ADT)

 5.What main components of Android application?

Activities: They dictate the UI and handle the user interaction to the screen.
Services: They handle background processing associated with an application.
Broadcast Receivers: It handles the communication between Applications and Android Operating system
Content Providers: They handle data and database management stuff.

6.Where will you declare your activity so the system can access it?

Activity is to be declared in the manifest file. For example:

  1.        <manifest></manifest>
  2.        <application></application>
  3.        <activityandroid:name=”.MyTestActivity”></activity>

7.Can you deploy executable JARs on Android? Which packaging is supported by Android?

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.

8.Define Android application resource files?

As an Android application developer, you can inject files (XML, JSON, JPEG etc) into the build process and can load them from the code. These injected files are revered as resources.

9.Where can you define the icon for your Activity?

Icon for an Activity is defined in the manifest file.

<activityandroid:icon=”@drawable/app_icon”android:name=”.MyTestActivity”></activity>

10.Android application can only be programmed in Java?

False. You can program Android apps in C/C++ using NDK .