Android Interview Questions and Answers
The Best LIVE Mock Interview - You should go through before Interview
Test your skills through the online practice test: Android Quiz Online Practice Test
Freshers / Beginner level questions & answers
Ques 1. What is Android?
Android is a complete set of software for mobile devices such as tablet computers, notebooks, smartphones, electronic book readers, set-top boxes etc.
It contains a linux-based Operating System, middleware and key mobile applications.
It can be thought of as a mobile operating system. But it is not limited to mobile only. It is currently used in various devices such as mobiles, tablets, televisions etc.
Is it helpful?
Add Comment
View Comments
Ques 2. Who has developed Android?
It is developed by Google and later the OHA (Open Handset Alliance). Java language is mainly used to write the android code even though other languages can be used.
Is it helpful?
Add Comment
View Comments
Ques 3. What is Open Handset Alliance (OHA)?
It's a consortium of 84 companies such as google, samsung, AKM, synaptics, KDDI, Garmin, Teleca, Ebay, Intel etc.
It was established on 5th November, 2007, led by Google. It is commited to advance open standards, provide services and deploy handsets using the Android Plateform.
Is it helpful?
Add Comment
View Comments
Ques 4. What are the features/advantages of Android?
Advantages of android follows:
- It is open-source.
- Anyone can customize the Android Platform.
- There are a lot of mobile applications that can be chosen by the consumer.
- It provides many interesting features like weather details, opening screen, live RSS (Really Simple Syndication) feeds etc.
- It provides support for messaging services(SMS and MMS), web browser, storage (SQLite), connectivity (GSM, CDMA, Blue Tooth, Wi-Fi etc.), media, handset layout etc.
Is it helpful?
Add Comment
View Comments
Ques 5. What are the categories of Android applications?
There are many android applications in the market. The top categories are:
- Entertainment
- Communication
- Tools
- Productivity
- Music and Audio
- Social
- Media and Video
- Personalization
- Travel and Local etc.
Is it helpful?
Add Comment
View Comments
Ques 6. What is the history of Android?
The history and versions of android is very interesting. The codenames of android ranges from A to J currently, such as Aestro, Blender, Cupcake, Donut, Eclair, Froyo, Gingerbread, Honeycomb, Ice Cream Sandwitch,Jelly Bean and KitKat.
Let's understand the android history pointly:
Initially, Andy Rubin founded Android Incorporation in Palo Alto, California, United States in October, 2003.
In 17th August 2005, Google acquired android Incorporation. Since then, it is in the subsidiary of Google Incorporation.
The key employees of Android Incorporation are Andy Rubin, Rich Miner, Chris White and Nick Sears.
Is it helpful?
Add Comment
View Comments
Ques 7. Describe Android Software Stack.
Android software stack (also known as android architecture) includes linux kernal, native libraries (middleware), Android Runtime, Application Framework and Applications.
Linux Kernal is responsible for device drivers, power management, resource access etc. OS tasks.
On the top of linux kernal, their are Native libraries such as WebKit, OpenGL, FreeType, SQLite, Media, C runtime library (libc) etc.
The WebKit library is responsible for browser support, SQLite is for database, FreeType for font support, Media for playing and recording audio and video formats.
The main Android API's are UI (User Interface), telephony, resources, locations, Content Providers (data) and package managers.
Is it helpful?
Add Comment
View Comments
Ques 8. Describe Android Core Building Blocks.
A component is simply a piece of code that has a well defined life cycle e.g. Activity, Receiver, Service etc.
The core building blocks or fundamental components of android are activities, views, intents, services, content providers, fragments and AndroidManifest.xml.
Activity
An activity is a class that represents a single screen. It is like a Frame in AWT.
View
A view is the UI element such as button, label, text field etc. Anything that you see is a view.
Intent
Intent is used to invoke components. It is mainly used to:
Start the service
Launch an activity
Display a web page
Display a list of contacts
Broadcast a message
Dial a phone call etc.
Service
Service is a background process that can run for a long time.
There are two types of services local and remote. Local service is accessed from within the application whereas remote service is accessed remotely from other applications running on the same device.
Content Provider
Content Providers are used to share data between the applications.
Fragment
Fragments are like parts of activity. An activity can display one or more fragments on the screen at the same time.
AndroidManifest.xml
It contains informations about acvities, content providers, permissions etc. It is like the web.xml file in Java EE.
Android Virtual Device (AVD)
It is used to test the android application without the need for mobile or tablet etc. It can be created in different configurations to emulate different types of real devices.
Is it helpful?
Add Comment
View Comments
Ques 9. What is Android Emulator?
Android Emulator is used to run, debug and test the android application. If you don't have the real device, it can be the best way to run, debug and test the application.
It uses an open source processor emulator technology called QEMU.
The emulator tool enables you to start the emulator from the command line. You need to write:
emulator -avd <AVD NAME>
In case of Eclipse IDE, you can create AVD by Window menu > AVD Manager > New.
Is it helpful?
Add Comment
View Comments
Ques 10. How to create/make android apps?
We are creating the simple example of android using the Eclipse IDE. For creating the simple example:
1) Create the new android project
2) Write the message (optional)
3) Run the android application
2) Write the message (optional)
3) Run the android application
1) For creating the new android project:
Select File > New > Project...
Select the android project and click next
Fill the Details in this diaglog box and click finish
Now an android project have been created. You can explore the android project and see the simple program.
2) For writing the message we are using the TextView class. Change the onCreate method as:
package com.example.helloandroid;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.widget.TextView;
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
TextView textview=new TextView(this);
textview.setText("Hello Android!");
setContentView(textview);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.activity_main, menu);
return true;
}
}
3) To run the android application:
Right click on your project > Run As.. > Android Application
The android emulator might take 2 or 3 minutes to boot. So please have patience. After booting the emulator, the eclipse plugin installs the application and launches the activity. You will see something like this:
Is it helpful?
Add Comment
View Comments
Ques 11. Describe Internal details of previous Hello Android application.
Here, we are going to learn the details of first android program.
Android application contains different components such as java source code, string resources, images, manifest file, apk file etc. Let's understand the project structure of android application.
MainActivity.java - Java Source
R.java in generated package - Generated R.java
bin folder - Contains apk file
drawable, activity_main.xml, strings.xml - Resources
AndroidManifest.xml - Manifest
Let's see the java source file created by the Eclipse IDE:
File: MainActivity.java
package com.example.helloandroid;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.widget.TextView;
public class MainActivity extends Activity {//(1)
@Override
protected void onCreate(Bundle savedInstanceState) {//(2)
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);//(3)
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {//(4)
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.activity_main, menu);
return true;
}
}
(1) Activity is a java class that creates and default window on the screen where we can place different components such as Button, EditText, TextView, Spinner etc. It is like the Frame of Java AWT.
It provides life cycle methods for activity such as onCreate, onStop, OnResume etc.
(2) The onCreate method is called when Activity class is first created.
(3) The setContentView(R.layout.activity_main) gives information about our layout resource. Here, our layout resources are defined in activity_main.xml file.
File: activity_main.xml
<RelativeLayout xmlns:androclass="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:text="@string/hello_world" />
</RelativeLayout>
As you can see, a textview is created by the framework automatically. But the message for this string is defined in the strings.xml file. The @string/hello_world provides information about the textview message. The value of the attribute hello_world is defined in the strings.xml file.
File: strings.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">helloandroid</string>
<string name="hello_world">Hello world!</string>
<string name="menu_settings">Settings</string>
</resources>
You can change the value of the hello_world attribute from this file.
Generated R.java file
It is the auto-generated file that contains IDs for all the resources of res directory. It is generated by aapt(Android Asset Packaging Tool). Whenever you create any component on activity_main, a corresponding ID is created in the R.java file which can be used in the Java Source file later.
File: R.java
/* AUTO-GENERATED FILE. DO NOT MODIFY.
*
* This class was automatically generated by the
* aapt tool from the resource data it found. It
* should not be modified by hand.
*/
package com.example.helloandroid;
public final class R {
public static final class attr {
}
public static final class drawable {
public static final int ic_launcher=0x7f020000;
}
public static final class id {
public static final int menu_settings=0x7f070000;
}
public static final class layout {
public static final int activity_main=0x7f030000;
}
public static final class menu {
public static final int activity_main=0x7f060000;
}
public static final class string {
public static final int app_name=0x7f040000;
public static final int hello_world=0x7f040001;
public static final int menu_settings=0x7f040002;
}
public static final class style {
/**
Base application theme, dependent on API level. This theme is replaced
by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
Theme customizations available in newer API levels can go in
res/values-vXX/styles.xml, while customizations related to
backward-compatibility can go here.
Base application theme for API 11+. This theme completely replaces
AppBaseTheme from res/values/styles.xml on API 11+ devices.
API 11 theme customizations can go here.
Base application theme for API 14+. This theme completely replaces
AppBaseTheme from BOTH res/values/styles.xml and
res/values-v11/styles.xml on API 14+ devices.
API 14 theme customizations can go here.
*/
public static final int AppBaseTheme=0x7f050000;
/** Application theme.
All customizations that are NOT specific to a particular API-level can go here.
*/
public static final int AppTheme=0x7f050001;
}
}
APK File
An apk file is created by the framework automatically. If you want to run the android application on the mobile, transfer and install it.
Resources
It contains resource files including activity_main, strings, styles etc.
Manifest file
It contains information about package including components such as activities, services, content providers etc.
Is it helpful?
Add Comment
View Comments
Intermediate / 1 to 5 years experienced level questions & answers
Ques 12. How to install softwares for Android?
Android supports java, c++, c# etc. language to develop android applications. Java is the officially supported language for android. All the android examples of this site is developed using Java language and Eclipse IDE.
Here, we are going to tell you, the required softwares to develop android applications using Eclipse IDE.
Simple way by ADT Bundle
It is the simplest technique to install required softwares for android application. It includes:
Eclipse IDE
Android SDK
Eclipse Plugin
If you download the ADT from android site, you don't need to have eclipse IDE, android SDK and eclipse Plugin because it is already included in adt bundle.
If you have downloaded the ADT bundle, unjar it, go to eclipse IDE and start the eclipse by clicking on the eclipse icon. You don't need to do any extra steps here.
Setup Android for Eclipse IDE:
In this page, you will learn what softwares are required for running an android application on eclipse IDE. Here, you will be able to learn how to install the android SDK ADT plugin for Eclipse IDE. Let's see the softwares required to setup android for eclipse IDE manually.
Install the JDK
Download and install the Eclipse for developing android application
Download and Install the android SDK
Intall the ADT plugin for eclipse
Configure the ADT plugin
Create the AVD
Create the hello android application
Is it helpful?
Add Comment
View Comments
Ques 13. What is Dalvik Virtual Machine for Android?
As we know the modern JVM is high performance and provides excellent memory management. But it need to be optimized for low-powered handheld devices.
The Dalvik Virtual Machine (DVM) is optimized for mobile devices. It optimizes the JVM for memory, battery life and performance.
Dalvik is a name of a town in Iceland. The Dalvik VM was written by Dan Bornstein.
The Dex compiler converts the class files into the .dex files that run on the Dalvik VM.
The javac tool compiles the java source file into the class file.
The dx tool takes all the class files of your application and generates a single .dex file. It is a platform-specific tool.
The Android Assets Packaging Tool (aapt) handles the packaging process.
Is it helpful?
Add Comment
View Comments
Ques 14. What is AndroidManifest.xml file in android?
The AndroidManifest.xml file contains information about your package, including components of the application such as activities, services, broadcast receivers, content providers etc.
It performs some other tasks also:
It is responsible to protect the application to access any protected parts by providing the permissions.
It also declares the android api that the application is going to use.
It lists the instrumentation classes. The instumentation classes provides profiling and other informations. These informations are removed just before the application is published etc.
This is the required xml file for all the android application and located inside the root directory.
A simple AndroidManifest.xml file looks like this:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.javatpoint.hello"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="15" />
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="@string/title_activity_main" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
Elements of the AndroidManifest.xml file
The elements used in the above xml file are described below.
<manifest>
manifest is the root element of the AndroidManifest.xml file. It has package attribute that describes the package name of the activity class.
<application>
application is the subelement of the manifest. It includes the namespace declaration. This element contains several subelements that declares the application component such as activity etc.
The commonly used attributes are of this element are icon, label, theme etc.
android:icon represents the icon for all the android application components.
android:label works as the default label for all the application components.
android:theme represents a common theme for all the android activities.
<activity>
activity is the subelement of application and represents an activity that must be defined in the AndroidManifest.xml file. It has many attributes such as label, name, theme, launchMode etc.
android:label represents a label i.e. displayed on the screen.
android:name represents a name for the activity class. It is required attribute.
<intent-filter>
intent-filter is the sub-element of activity that describes the type of intent to which activity, service or broadcast receiver can respond to.
<action>
It adds an action for the intent-filter. The intent-filter must have at least one action element.
<category>
It adds a category name to an intent-filter.
Is it helpful?
Add Comment
View Comments
Most helpful rated by users:
- What is Android?
- Who has developed Android?
- What is Open Handset Alliance (OHA)?
- What are the features/advantages of Android?
- What is the history of Android?
Related differences
Related interview subjects
iOS interview questions and answers - Total 52 questions |
Ionic interview questions and answers - Total 32 questions |
Android interview questions and answers - Total 14 questions |
Mobile Computing interview questions and answers - Total 20 questions |
Xamarin interview questions and answers - Total 31 questions |