Home » Articles

Java fundamentals for Android Application Development.

Hello everybody, glad to have you all here, learning new-fangled things always makes one’s excite. We www.includehelp.com provide here the Basic Development of an Android App from the Initial stage.

Introduction

Android, which is a Google’s most Cool product ruling the world since it came into existence. The world needs almost Two Million Android Developers now and next heading three years, words by Sundar Pichai, CEO of Google at SRCC institute addressed the students, where all the developers are been trained under Google and will be furnished with Good package earnings. Not only for Google? Many MNC’s and Small Scale Companies do seeking for an Android Developer/Mobile Application developer .Yes, Of course the requirement at niche. Android initially for the mobile devices further on developed Android Wrist Watches, televisions, Android Auto for cars with unique interfaces. Hence job opportunities are of at very high. So, all the IT and NON-IT guys should be well equipped with the Knowledge of Android Programming which has a path for a bright career..

Let’s have a Look

When it taken its Roots

Firstly, Android is an Open Source Linux based mobile Operating System developed by Open Handset Alliance, led by Google and association with other companies brought their product in 2005 holding with different features competing with Apple . It’s better to switch to the next content as history can be also learnt in the Wikipedia. Don’t fret; later on we will switch to the features and so on when the actual Android development starts.
Let’s start up with basics need for Android development.

Initiation

To be initiate with an Android Programming all you need to be Equipped with JAVA. Android was developed using OOPS concepts (Object Oriented Programming System).
Hey, don’t be tensed pals; I will not put you in dilemma. We’ll just go in a way by easy & happy learning. If you already experienced Java just have a glance at it, enough.

JAVA Basics

JAVA is one of the most popular programming language and computing platform, it was released first in 1995 by Sun Microsystems. But now it’s a part of Oracle Corporation.
JAVA is popular because of its features; Most common of features of JAVA are Object Oriented, Simple, Platform Independent, Secured, Robust, Portable, Multithreaded etc.

Program Development Steps

JAVA Basic Structure

As if now learning each section is time consuming, so just given a simple definitions. In their usage the explanation will be given.

Document Section :
Here generally mentions what task have been doing with /* The text comes Here */ and java also allows single lined comment //Text Here.
Package Statements:
The package statement identifies the package that a Java program belongs to. If your program does not include a package statement, the program belongs to the default java package.
Syntax: package package-name;

Package-name refers to name of package that program shall be added to.

            package OurExample;
        
import statements:
import is the java keyword used to include the particular package libraries to the program.
            import package.*;
        
Here * collects and load the packages into your program.
            import java.io*; //input & output function library
        
class:
A class describes the functions and variables that are included to an Object. Simply, class has attributes and operations for a particular object.
            public class  classname{
            Statements
            } 
        
main method:
The method at which the program execution starts.
        public static void main(String args[])
        {
        Statements
        }
        
The whole statement will be explained further, as if now just be known with the syntax.

Java Environments

A JAVA Application are usually compiled to Byte Code (class file) that can run on any Java virtual Machine (JVM) regardless of the operating system running on it. It was designed to let developers "write once, run anywhere"(WORA), meaning that code that runs on one platform does not need to be recompiled to run on another.

Java Environments

In above figure we can understand that the arrow pointing towards down, states that JVM ground layer above it JRE whereas both controlled by JDK.

Java Virtual Machine (JVM):
As name states that it’s a virtual machine when user compiles the program it initially creates a Class file which is called as Byte Code (which is not native Code).JVM reads this byte code and converts this to underlying Operating System comprehensible code .So JVM translates the byte code into machine understandable code whereas the machine language depends on the particular operating system being used. From this it is clear that JVM is a platform dependent.

Java Run time environment (JRE):
It’s a program execution environment for the implementation of JVM which physically exists and contains set of libraries and other files that JVM uses at runtime. You can run java programs once if you install JRE. To start writing Java programs you need to setup JDK as well.

Java Development Kit:
To start the Java programming JDK should loaded into your Machine you can do so by downloading it from Java SE downloads webpage on Oracle.com –the owner of Java. Make sure to download the correct Latest version compatible to your machine (32bit or 64bit installer).

After your installation completes check whether it installed in your system

  • Open a command prompt by clicking start -> run, then type cmd.
  • In the windows that opens, type java –version.
  • You will see the following information as below.
Java command propmt

Or else in command prompt type "javac" if your java installed you will get bunch of libraries list. If no such type then do the following.

For windows:
  • Go to java installation directory, normally exists as C:\Program Files\Java\jdk1.8.0_65\bin
  • Copy the address
  • Right click on My Computer, select Properties, then advanced system settings, then Environment Variables. Then, you would update the PATH value.
Java command propmt

Change variable name according to you

Java command propmt

Press Ok, and your task done.

For Linux:
  • In Linux, if the SDK is installed in /usr/local/jdk1.8.0_65 and you use the C shell, you would put the following code into your .cshrc file.
  • set env PATH /usr/local/jdk1.8.0_65/bin:$PATH
  • set nv JAVA_HOME /usr/local/jdk1.6.0_15
  • Alternatively, if you use an Integrated Development Environment (IDE) Eclipse, then it will know automatically where you have installed your Java.

Installation of Eclipse

For Windows or Linux:
You can download the latest compatible version of Eclipse from the official site http://www.eclipse.org/downloads.
Unpack the binary distribution into a location. I recommend C drive. Eclipse can be started by executing the following commands on windows machine, or you can simply double click on eclipse.exe %C:\eclipse\eclipse.exe

JAVA Workspace

Choose the Workspace and start it up..

In Linux: Can be started by executing this command:
$/usr/local/eclipse/eclipse .

Build First Java Project

  • Open eclipse.exe and give workspace then press Ok.

    JAVA Workspace
  • Go to File > New > Java Project > Sample > finish.
  • Go to file > New > Class > Give class name as Sample > ok
  • Type the code:
public class Sample 
{
public static void main(String args[])
{
System.out.println("Hello everyone.");
System.out.println("Thanks for visiting this site");
}
}
        

JAVA Workspace

Output
Hello everyone.
Thanks for visiting this site
        



Comments and Discussions!

Load comments ↻





Copyright © 2024 www.includehelp.com. All rights reserved.