Android 1 Programming Tutorial install SDK, Eclipse plugin and Hello world first program


Uploaded by edu4java on 07.11.2010

Transcript:
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.
Quick Start…
And it says;
Point 1: Prepare your development computer
Ok, basically here it’s 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
Windows…
I'm going to choose Windows
Basically because I have Windows
Here I had already downloaded this
Then I'm going to pick the one I have here… double click here
You are going to see a little folder here
I am going to drag and drop this to the Desktop
I expect you download it in a better location than me
For example C:\ root or C:\android
Anyway, if you double click this folder you are going to find
An SDK Manager.exe
Then make a double click on it
Here we recommended you to download all these packages
But we are going to choose a few
In order it doesn’t take so long to download it
Available packages…
Let’s see what we have here…
Sdk plataform
We are going to choose this and this one
This is the Sdk, the last Sdk
API 8 and these are the examples for this Api
Ok, I’ll choose the last one and the examples
Once we have them selected... Install Selected
Accept and Install
Then will have to wait for the download
Thanks to the magic of the TV the waiting is shorter
Ok, let’s continue with the Eclipse plugin, with the installation
Follow the instructions; Install the ADT plugin for Eclipse
We are going to pick this URL
Copy and go to Eclipse - help –
Install new software
Add, we are going to put the url here
As a name and as a location
Then we select all we get from this url
Next,
Next,
Accept... finish
Installing software
The plug-in is installing
Ok, here we get a warning about the validation
Ok, we can trust it…
Restart now, ok
We are going to restart now
Eclipse is coming…
Here we are, we have the eclipse plugin installed
Now we have to inform the eclipse plugin where the Android SDK is
Windows – preferences – Android.
And the SDK location…
I have already this but you are going to have this empty
Go to Browse and choose the location where you put the SDK
If you remember I left it in Desktop … Android SDK
Just drag and drop it and when you choose it you´re going to get this
It is the api we downloaded
Ok Android plugin has been installed and configured
Now we are going to create a new project
An Android project,
With the plugin we have now the option; Android project
We need a project name;
Android tutorial 1
We need an application name;
We need a package, a default package
We need to define the activity
Any application has at least one activity… ok, maybe not
In this case, we are going to define the main activity,
the one which is going to start the application
I called the activity “Ventana” because “Ventana” means Window in Spanish
In the package name you can see I put the typical java package
Ok, minsdk version… I´m going to use 7, because I want to try this in my phone
And I have this version
We have to choose one of this
Even if I choose minsdk version 7 I can take Android 8 api
This is a bit risky but you can do that…
Ok, I will finish it
Here we are
Let’s check this, what we have here…
The most important thing of the entire project and the most important file is
The Android manifest
This is the definition of the application
It starts with a tag manifest and we can find here the application tag
Inside the application tag we are going to find the tag activity,
The tag services, the content providers, ok…
The activity tag talks about a “Ventana”,
If you remember the name “Ventana” was the name of the activity
If we go here we can see in the source code, we have the “Ventana”
There is a class Ventana which has the same name as the Activity
This dot means that Ventana is in the default package
The default package is this
You can see here you have the default package here
Ok, we can check this,
The activity, the label, talks about /app name
App name is defined as a string resource
Where is it? If you come here you find resource
And in resources you can find values and in value you can find strings.xml
If you check strings.xml… app name…
Then, instead of writing the literature here
We have an indirect reference through the string resources that are here
The same thing happens with this… Hello World Ventana
We can see this is defined here and is used for example here…
This is another important file; the main xml
Now you can see how it is referenced from here
Ok, let’s start the application to see what happens
You can go here… run as… Android application
Here you receive a message that says; you have no virtual device configured
Yes, we want to define a new one
We get into the manager we saw before, we are going to say new
And we are going to put a name for this device
We are going to call it dev22,
With a target Android 2.2- Api level 8
They ask for the size of the memory, the internal memory
You can put it like this…
This is the default view, you can configure different screens
Ok, the default is ok
Create AVD
Once you have created it, you can select it and ask to start
I think it is already starting,
Yes, it’s launching
Anyway we are going to try to start it directly
Launch…
Here it is loading
Here we are still waiting for the application to be installed
But the device is already installed
The first time it takes too long
We are going to check what happened
We are going to start it again to try to…
Run as… android application
I check what happened
Here it is, we are there…
Ok, as you can see Hello World Ventana, Android Tutorial 1
This is what we have here
We can change and put Hello Edu, for example
Save and again run as… Android application
We go here and the application is starting again
Hello Edu, ok!
I think this enough for the first tutorial,
In the next tutorial we are going to see the components and more about Android
See you!!!