Dear Students, *Welcome to the class of Android . I hope you will find this Android app development session to be very exciting (I can bet that it is going to be very interesting to the students who love programming !!). I hope you must have followed the steps of document one to install the eclipse environment.

sunglowmaizeΚινητά – Ασύρματες Τεχνολογίες

10 Δεκ 2013 (πριν από 3 χρόνια και 3 μήνες)

90 εμφανίσεις

Dear Students,

*Welcome to the class of Android . I hope you will find this Android app
development session to be very exciting (I can bet that it is going to be very
interesting to the students who love programming !!).

I hope you must have followed th
e steps of document one to install the eclipse

*What basically we need to first understand is that “what is android?”

What makes it so exciting and interesting????

Android is a software stack for mobile devices that includes an operating

middleware and key applications. The
Android SDK

provides the tools and APIs
necessary to begin developing applications on the Android platform using the Java
programming language.

In simple words Android is the mobile operating system as we hav
e Windows for

On this Android you can make lots of apps like games , stylish notepads where you
can place your favorite actors photos.!!

Android is so vast , it has so many features in it . Mentioning them all and
explaining them all at this poin
t won't be good. . Through this document my idea is
to teach
all students

as far as possible
, the basic concepts of Android
so that
once you are aware with the components of Android , you can
easily program by yourself.

ater on ,when you g
ain confidence you can start
exploring more of it into details. I hope you must be aware with the Java

I would also recommend that you also look into these sites for references.

Ok s
tudents so lets get ready .

I would recommend that you explore the eclipse a little so that you can get a basic
idea. Donot worry, we will be doing examples , so that you will have a clear
understanding of how things are been done.


In th
is tutorial, you will run your application in the Android

The Android SDK includes a mobile device emulator

a virtual mobile device that
runs on your computer. The emulator lets you prototype, develop, and test Android
ns without using a physical device.

1) You must create an Android Virtual Device (AVD). An AVD defines the system
image and device settings used by the emulator.

To create an AVD:


In Eclipse, choose
Window >
Android SDK and AVD Manager




in the left




Create New AVD



Type the name of the AVD, such
as "my_avd".


Choose a target. The target is the
platform (that is, the version of
the Android SDK, such as 2.1) you
want to run on the emulator.


u can ignore the rest of the
fields for now.


Create AVD

Create a New Android Project

After you've created an AVD, the next
step is to start a new Android project in Eclipse.


From Eclipse, select
File > New >


If the ADT Plugin for
Eclipse has
been successfully installed, the resulting dialog should have a folder labeled
"Android" which should contain "Android Project". (After you create one or more
Android projects, an entry for "Android XML File" will also be available.)


Select "An
droid Project" and click


Fill in the project details with the
following values:

Project name:


Application name:

Hello, Android

ckage name:

com.example.helloandroid (or your own private namespace)

Create Activity:




Here is a description of each field:

Project Name

This is the Eclipse Project name

pplication Name

the name that will appear on the Andr
oid device.

Package Name


The package name under which the stub Activity will be generated. Your

package name must be unique across all packages installed on the Android system; for this
reason, it's important to use a standard domain
style package for y
our applications. The example
above uses the "com.example" namespace, which is a namespace reserved for example

when you develop your own applications, you should use a namespace that's
appropriate to your organization or entity.

Create Act

This is the name for the class stub that will be generated by the plugin. This
will be a subclass of Android's

class. An Activity is simply a class that can run and do
work. It can create a UI if it chooses, but it doesn't need to. As the
checkbox suggests, this is
optional, but an Activity is almost always used as the basis for an application.

in SDK Version

This value specifies the minimum API Level required by your application.

Run the Application

The Eclipse plugin makes it ea
sy to run your applications:

Run > Run

Select "Android Application".

The Eclipse plugin automatically creates a new run configuration for your project
and then launches the Android Emulator. Depending on your environment, the
Android emulator

might take several minutes to boot fully, so please be patient.
When the emulator is booted, the Eclipse plugin installs your application and
launches the default Activity. You sho
uld now see something like this.

Lets get familiar with other parts of an
droid project

based layout files: file that contain all the user interface components.


: This is an XML namespace declaration that tells the Android
tools that you are going to refer to common attributes defined in the
Android na
mespace. The outermost tag in every Android layout file must
have this attribute.


This attribute defines how much of the available width on
the screen this View should consume. In this case, it's the only View so you
want it to take u
p the entire screen, which is what a value of "fill_parent"


This is just like android:layout_width, except that it
refers to available screen height.


This sets the text that the TextView should display. In this
example, you use a string resource instead of a hard
coded string value. The

string is defined in the

file. This is the
recommended practice for inserting strings to your application, because it
makes the localization of your a
pplication to other languages graceful,
without need to hard
code changes to the layout file..

This is where you should save all default text strings for your user

file is an index into all the resources defined in the fi
le. You use this
class in your source code as a sort of short
hand way to refer to resources
you've included in your project. This is particularly powerful with the code
completion features of IDEs like Eclipse because it lets you quickly and

locate the specific reference you're looking for.

Debug Your Project

The Android Plugin for Eclipse also has excellent integration with the Eclipse
debugger. To demonstrate this, introduce a bug into your code. Change your
HelloAndroid source code to loo
k like this:

This change simply introduces a NullPointerException into your code. If you
run your application again, you'll eventually see this:

Press "Force Quit" to terminate the application and close the emulator

To find out more about th
e error, set a breakpoint in your source code on
the line
Object o = null;

click on the marker bar next to the source
code line). Then select
Run > Debug History > Hello, Android

from the
menu to enter debug mode. Your app will restart in the emula
tor, but this
time it will suspend when it reaches the breakpoint you set. You can then
step through the code in Eclipse's Debug Perspective, just as you would for
any other application.

From the next tutorial we will be working on different kinds of Me

As it won't be possible to explain all the coding , I will explain main lines and
will include lots of .apk files which you can import on Eclipse and see the