From Java to Android - Issue#1(Introduction and installation)

in #utopian-io6 years ago (edited)

andjav.jpg
Image Source

What is Android ?


Android is an operating system, based on a linux kernel, for mobile devices (mainly smartphone, but it is evolving at high speed V, a significant number of 10 "and 7" touchscreen tablets, running on Android).

Android is developed by a consortium: the Open Handset Alliance.
The Open Hanset Alliance brings together many companies related to new technologies (Intel, HTC, Motorola, Garmin, .....), but the main contributor is Google!In theory Android is a free system (just like GNU / Linux), but without wanting to enter the controversy waving the net, I'll say that .... it's a little more complicated than that, Android is freeon paper (licensed "Apache Open Source License v2"), but not really in the facts!

Develop Android applications


Thousands (see many more!) Of people (more or less professional) develop Android applications. Many of these applications are found on the big supermarket Android apps set up by Google: the Android Market. Many applications are free, others, paying (usually a few euros), some, are of high quality, others, much less.

It is relatively "easy" to create a (simple) application for Android (this probably explains the number of applications of very "average" quality found on the Andoid Market!), it "is enough" to have a good foundation in Java programming (normally this should be your case) and to be ready to make the necessary efforts to acquire some particular methods of development under Android.

The programs intended to be used under Android, are written in Java, but one must have to mind that a program running on the Java virtual machine developed by Sun (JVM: Java Virtual Machine, the one we've used so far), will not work under Android.
Android is for mobile devices with low power (compared to a computer classic), Google has developed its own virtual machine: Dalvik.
Some classes available under FMV will not be under Dalvik, so be careful. In addition to Java, the development of Android applications, requires some knowledge in XML.

XML, what is this? How to learn?


Do not panic, it will take you a few minutes to understand the basics of XML.
XML stands for eXtensible Markup Language (in French: extensible markup language). XML is not a programming language, there is no for loop, if, while, ......
It is almost exclusively used to store (or transfer from one program to another) data (text) in a structured way.

It's a language that uses tags (like HTML for those who know!). The tags are opening, <open-tag> or closing, </ closing-tag>. When you open a tag, you must at one time or another close it. It is possible to put text between the opening tag and the closing tag: <tag1> Here is the inserted text </ tag1>
Tags can be nested: we can insert one or more pairs of tags (opening and closing) between 2 tags (opening + closing) here is an example to store information on your film library:
Bt1.png

the <cinematheque> tag is called the "root element", the <movie> tag is the "first child", and so on.
An XML file must have a "root element".
When there is no text between the opening tag and the closing tag, we can replace: <tag> </ tag> with <tag /> (which is both the opening tag and the closing tag).
A tag can contain attributes: <name tag = "Toto" first name = "John Stone" /> first and last name are attributes that will be used by a third party program. An XML file must always begin with a line called prologue:
<? xml version = "1.0" encoding = "utf-8"?>
This line specifies the version of XML used (here, it is version 1.0) and the type of encoding for the document.

To end this introduction on XML, here is one of the XML files that we will use very
frequently when developing Android applications.
bt2.png
We will not go into details (for now!), But you can already notice, the prologue line (1st line), the tags: LinearLayout and TextView (open and closing), the TextView tag (which is opening and closing) is between the tags Opening LinearLayout and LinearLayout closing.
Each tag contains attributes (orientation, layout_width, ....)
You have also probably noticed:
xmlns:android="http://schemas.android.com/apk/res/android"
This line is related to the notion of namespace, just like the android: following lines.

Installing the SDK and configuring Eclipse


To develop Android applications, we will use Eclipse (as for the Java application development "classic")
We will have to download 2 other components:

  • the SDK (software development kit) Andoid which will contain all the "tools" allowing us to "build" applications on Android.

  • The plugin "Android for Eclipse" ADT, which adapts Eclipse to the development of applications under Android.
    The SDK must be downloaded at the following address:-
    http://developer.android.com/sdk/index.html
    jbt3.png

  • Choose the file android-sdk_r07-windows(watch out for upcoming versions of Android, the file will change name, do not be surprised if you can not find android-sdk_r07-windows.zip)

  • Once downloaded, open the fileandroid-sdk_r07-windows.zip, "unzip" the folder"android-sdk-windows", and install the SDK (double click on the SDK Manager file).

  • You should see the following window:
    jbt4.png

  • Check that "Accept All" is checked and click on "Install"

  • Then there is only to wait.
    jbt5.png
    Sometimes, long ... (it depends on the quality of the internet connection).

  • Once the installation is complete, click on the close button.
    jbt7.jpg

  • Then close the "Android SDK and AVD Manager" window.

The SDK is installed, now next is installation of the plugin for Eclipse, the ADT module, Which i guide in my next post.

So stay tuned and wait for my next post.



Posted on Utopian.io - Rewarding Open Source Contributors

Sort:  

Thank you for teaching what is android and XML I really enjoyed reading the post.

Wow I loved reading the post....thanks for sharing about android and XML...

Your contribution cannot be approved because it does not refer to or relate to an open-source repository. See here for a definition of "open-source."

You can contact us on Discord.
[utopian-moderator]

But i'm writing a tutorial about android and java, both are open source languages. Then why not approved?