Configuring
Android Development
Environment
B.Bhuvaneswaran
Assistant Professor (SS)
Department of Computer Science & Engineering
Rajalakshmi Engineering College
Thandalam
Chennai 602 105
[email protected]
Requirements
JDK 6 (Java Development Kit ) and above
http://www.oracle.com/technetwork/java/javase/downloads/index.html
Eclipse + ADT
SDK
developer.android.com/sdk/index.html
B.Bhuvaneswaran, AP (SS) / CSE / REC
Configuring Android Online
B.Bhuvaneswaran, AP (SS) / CSE / REC
Configuring Android Offline
B.Bhuvaneswaran, AP (SS) / CSE / REC
Creating Android Virtual Device (AVD)
B.Bhuvaneswaran, AP (SS) / CSE / REC
Familiarization with Eclipse IDE
B.Bhuvaneswaran, AP (SS) / CSE / REC
Important components of Eclipse for
Android
1)
2)
3)
4)
package Explorer
DDMS (Dalvik Debug Monitor Server )
LogCat
Console
B.Bhuvaneswaran, AP (SS) / CSE / REC
Sample Application
B.Bhuvaneswaran, AP (SS) / CSE / REC
Understanding Android Project
Structure
1) src folder:
2) bin folder:
It contain text file, image file, video file etc.
4) res folder:
It contain .apk file.
3) Assests folder:
It contain .java file.
It has drawable and layout directory which contain
main.xml file.
5) value folder:
It contain string.xml file.
B.Bhuvaneswaran, AP (SS) / CSE / REC
AndroidManifest.xml file
R.Java and Resource
Assets
Widgets
B.Bhuvaneswaran, AP (SS) / CSE / REC
AndroidManifest.xml file
Every application must have an
AndroidManifest.xml file.
The manifest presents essential
information about the application to the
Android system.
B.Bhuvaneswaran, AP (SS) / CSE / REC
The manifest does the following
1) It names the Java package for the application. The
package name serves as a unique identifier for the
application.
2) It describes the components of the application :
The activities, services, broadcast receivers, and content
providers.
3) It determines which processes will host application
components.
4) It also declares the permissions that others are
required to have, in order to interact with the
components of the application.
5) It declares the minimum level of the Android API,
that the application requires.
B.Bhuvaneswaran, AP (SS) / CSE / REC
R.Java
The file R.java is an auto-generated file,
that is added to your application, by the
Android plug-in.
This file contains pointers into the
drawable, layout, and values directories.
You should never modify this file directly.
You will be only referencing R.java in most
of your applications.
B.Bhuvaneswaran, AP (SS) / CSE / REC
Auto-generated code in R.java
package testPackage.HelloWorldText;
public final class R {
public static final class attr {}
public static final class drawable
{
public static final int icon=0x7f020000;
}
public static final class layout
{
public static final int main=0x7f030000;
}
public static final class string
{
public static final int app_name=0x7f040000;
}
B.Bhuvaneswaran, AP (SS) / CSE / REC
Resources
Almost all Android applications will have
some sort of resources in them; at a
minimum they often have the user
interface layouts in the form of XML files.
B.Bhuvaneswaran, AP (SS) / CSE / REC
B.Bhuvaneswaran, AP (SS) / CSE / REC
Resources
The three files that make up the default
resources, are created in the Resources
folder:
ic_launcher.png - The default icon for the
application.
Main.xml - The default user interface layout
file for the application.
Strings.xml A string table to help with
localization of the application.
B.Bhuvaneswaran, AP (SS) / CSE / REC
Assets
Assets provide a way to include arbitrary
files like text, xml,fonts, music, and
video, in your application.
If you try to include these files as
'resources', Android will process them into
its resource system, and you will not be
able to get the raw data.
If you want to access data untouched,
using Assets is one way to do it.
B.Bhuvaneswaran, AP (SS) / CSE / REC
Android offers one more directory where
you can keep files which also will be
included is package. This directory called
/assets.
The difference between /res and /assets is
that, Android does not generate IDs of
assets content.
You need to specify relative path and
name, for files inside /assets.
B.Bhuvaneswaran, AP (SS) / CSE / REC
Code to Access Assets :
InputStream is = getAssets().open("text.txt");
B.Bhuvaneswaran, AP (SS) / CSE / REC
Widgets
Android widgets can, bring lot of useful
information directly to your home screen,
without the need to start the application.
Widgets should be viewed as mini
applications that sit on your home screen.
They display various bits of information
from the main application.
B.Bhuvaneswaran, AP (SS) / CSE / REC
Widget types
1)Information widgets
Information widgets typically
display a few crucial information
elements that are important to
a user and track how that information
changes over time.Good examples
for information widgets are
weather widgets, clock widgets
Weather widgets
B.Bhuvaneswaran, AP (SS) / CSE / REC
2) Collection widgets
As the name implies, collection widgets
specialize on displaying multitude elements
of the same type, such as a collection of
pictures from a gallery app, a collection of
articles from a news app or a collection of
emails/messages from a communication
app.
ListView widget
B.Bhuvaneswaran, AP (SS) / CSE / REC
Summary
1)
2)
3)
4)
5)
6)
Installation
Creating AVD
Familiarization with Eclipse IDE
Resources
AndroidMenifest.xml
Widgets
B.Bhuvaneswaran, AP (SS) / CSE / REC
References
www.developer.android.com
www.developer.android.com/sdk/index.html
B.Bhuvaneswaran, AP (SS) / CSE / REC
B.Bhuvaneswaran, AP (SS) / CSE / REC
B.Bhuvaneswaran, AP (SS) / CSE / REC