Primer Programa, instalación SDK, Eclipse plugin
Hello I am
edu from edu4java and this is the first Android tutorial.
We are
going to make our first Android program
The first
thing we are going to do is download Android SDK
Android SDK
Here we
are.
Ok, lets go
to Quick Start and it says;
Prepare
your development computer
Ok,
basically here is says that you must have already installed Eclipse and Java
JDK.
I recommend
you Eclipse 3.5 and JDK 1.6
If you
don't know how to install them, there is a tutorial in edu4java;
The first
tutorial which shows you how to install Eclipse and JDK
Let's go to
point 2.
Download
and install the SDK starter package
It is about
this links that we have here.
I'm going
to choose Windows
Basically
because I have Windows
Here I
cheated on you, I had already downloaded it
Then I'm
going to use this one
Once you
have downloaded it you double click
And you are
going to see a little folder inside
Android-sdk-windows
You drag it
You better
drop it in a folder like C:\
Or
C:\android for example
I put it in
the desktop to make this tutorial more simple
Once we
have download the folder android-sdk-windows we are going
To execute
SDK Manager.exe
This runs
this
Here we are
recommended to download all this
You can do
it but to be quicker I'm going to cancel it
Lets take a
look, this is a manager which let us download different ...
SDK
packages
Let's see
what we've got available packages
We are
going to download this SDK and the API
There are a
lot of SDK versions, 8,
Android 2.2
,API 8, Android 2.1 the API 7,
I'm going
to download this one which is the last version of sdk
And this
one which is the last version of the examples.
Once we
have them... Install Selected
Accept and
Install
And now
wait
Thanks to
the magic of the TV the waiting is shorter
Everything
is downloaded.
Close
ok, let's
leave it here.
Let's
continue with eclipse.
Follow the
instructions to do it right
Install the
ADT plug-in for Eclipse
Copy this
URL
Go to
Eclipse
- help –
Install new
software
Add a new
site from where to download plug-ins
Select
these,
Next,
Next,
Accept...
finish
And the
plug-in is installing
Here we get
a warning
Unsigned
component
Click ok,
is not important
Finish...
your are asked to restart click
Ok, we have
the eclipse plug-in installed
Now we need
to inform the eclipse plug-in for Android where is the Android SDK
Go to
windows – preferences – Android.
I have this
already from before but you have to go to browse and
Select the
SDK location where you put it, for example I put it in
Desktop
Android here
And you are
going to put this folder...
Ok and
automatically this is going to appear
That is the
sdk version you have.
Ok, the
android plug-in has already been installed and configured.
Right
button on the mouse,
New,
Other...
you are going to have a tab android where you have an android project
Like this
we can create an android project... Ok
We are
going to put a name
Android
tutorial 1
We are
going to put application name
Android
tutorial 1
We are
going to put a package name
com.edu4java.android.tutorial1
We are
going to put an activity
Ok, an
activity it is not exactly a window but we can consider it as one
For the sdk
version we are going to use 7,
We are
going to use 8, but we are going to say we'll use 7.
It is a bit
risky but anyway
Finish
Now we have
new project
As you can
see it generated a lot of files and directories
Let's go
over it;
The main
element is the android manifest xml
This is the
main element inside the android program
This
manifest has a tag application
And inside
the application it has generated automatically an activity
Which would
be the window
nombre.ventana,
This
.ventana is making reference to a class which was also generated: ventana.java
This point
here is because the default package is this one
To avoid
writing this, this way
Android
allows us to write it .ventana
We are
talking about this class which is inside this package
Ok,
afterwards we are going to see what an intent is...
This a
window
Let's see
if we can run this application and see the window
This is all
generated code
Let's see
the window
The
activity has a label which is going to be string/app name
This app
name is taken out of a string which in the folder resource,
Values has
a xml strings
This would
be as
What is
here is going to be taken from here
It will
show android tutorial 1
Hello World, ventana! es el hello
Which is
going to be used in the layout
The layout
is this one
It access
to Hello World, ventana!
Let's run
the program and continue talking later
Press right
button of the mouse
Run as-
android application
As we have
told the plug-in where the sdk is
He is going
to run the sdk
We are
going to run the emulator
The
emulator of an android telephone
Its loading
This
emulator automatically
When we are
compiling we run the emulator and all the code of the project is going to be
compiled and copied inside the telephone
And when
this is finish loading our application will be showed.
It takes
its time
I don't
know why but it is shown in this type of screen
Normally we
press menu to show the application
Android
tutorial 1 Hello World, ventana!
Let´s go to
the string and change Hello World, ventana! for Hello World, Edu!
We save and
we go back to run as android application
And load
the emulator
And we can
see that the application now says Hello Edu! in the android
Ok, with
this we finish the first android tutorial and now we are going to carry on
making android tutorials
See you in
the next one