Tuesday, 15 July 2014

Android Linear Layout

Well on this time we are going to see about Linear layout in android xml file. Android xml file is used to provide the UI for the project.Here we are going to the Linear Layout in android.
Linear Layout is a common layout that is used to assign the area in the Android UI.If you want to allocate the particular area for the textView or Button then you can use the LinearLayout.In android it also contain RelativeLayout ,FrameLayout etc.LinearLayout can be assign by Programmically,it contain the android layout width,height etc.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/previewview"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" >
<TextView
                    android:id="@+id/text_view_2"
                    android:layout_width="90dp"
                    android:layout_height="wrap_content" />
<Button
        android:id="@+id/button1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_above="@+id/textView1"
        android:layout_alignRight="@+id/textView1"
        android:layout_marginBottom="25dp"
        android:text="Button" />
        <LinearLayout
            android:id="@+id/logoContainer"
            android:layout_width="20dp"
            android:layout_height="26dp"
            android:layout_gravity="top|left"
            android:layout_margin="2dp"
            android:background="@color/candidate_other" >
            <ImageView
                android:id="@+id/moveToStartArrow"
                android:layout_width="20dp"
                android:layout_height="20dp"
                android:layout_marginBottom="2dp"
                android:layout_gravity="center_vertical"
                android:src="@drawable/emmozhi_icon" />
        </LinearLayout>
</LinearLayout>
A LinearLayout contiant the button,textview,imageView etc in android.In the above program we are imported the xml verdsion package and we created the id for the android LinearLayout.the id is used to call the LinearLayout on the java file(for example human have name)so these id is used to identify the LinearLayout.
And we can also set the layout height and width of the LinearLayout by using width and height.When we are using height and weight we need to give the value by manually or automatically. LinearLayout width and height contain three values such as fill_parent,match_parent,wrap_content.
Fill_parent and match_parent optimizes full line of the LinearLayout and wrap_content take the exact size of the layout.If you want to manually enter the value you need type “30dp” to the width and height.
LinearLayout contain the orientation to place the text,image and button in android.Orientation is of two types they are vertical and horizontal.
You can also create the nested LinearLayout,it contain various function to align the layout by your wish like marginTop,left,bottom and Right.You can also set the background image for your layout.These are the various function of Linear Layout I hope you got some ideas about Linear Layout.

Android onClick Listener Application

Well on this time we are going to see how to create the application with onClick listener in android.For that we need to create the android application project first.For that double click the eclipse IDE and goto new android application project .
     After that your project will appear in the package Explorer you need to expand the package explorer on that select the src folder and you will get the java code such as MainActivity.java  after that double click the java file.

     Inside  the res folder goto to the layout folder and select the activity_main.Xml file and you need to enter the coding for android onClick listener.Xml is used for UI design so you need to create the button in the xml file.

<?xml version="1.0" encoding="utf-8"?>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"

    android:layout_width="match_parent"

    android:layout_height="match_parent"

    android:orientation="vertical"

> 



    <Button

        android:id="@+id/button1"

        android:layout_width="150dp"

        android:layout_height="50dp"

        android:layout_marginTop="20dp"

        android:layout_marginLeft="90dp"

        android:text="Press to start" />

</LinearLayout>

     Layout is used to split the partition in android.And in the layout you are creating the Button and after that you are assigning the width and size for your button.

     Thats it you have been created the button now you need write the backend process of button by using java code.

     Now open the src folder and MainActivity.java file.Now insert these coding in the java file.

public class Emmozhi extends Activity {

protected void onCreate(Bundle savedInstance)

       {

              super.onCreate(savedInstance);

              setContentView(R.layout.activity_main);

Button main_button=(Button)findViewById(R.id.button_1);

Main_button.setOnClickListener(new View.OnClickListener() {

public void onClick(View arg0) {

Toast.makeToast(getApplicationContent,”you clicked the button”,Toast.LENGTH_LONG).show();

}

             

});



        }


}

     First you are creating the button instance in the oncreate method then you placed the onclick listener for the button using the button object.Once the button clicked it will display this “You clicked the button”congratulation you created the onClickListener application.

Android Runtime Configuration

Now we are going to see how to run the android application in the eclipse IDE.We can use the android virtual device in android, so there is no need for android original mobile to run the application follow the steps.
First you need to create the android application project and then right click the project from the android package explorer after that press the run as in the middle of the pop up and now you can able to see the different running options like a android application,android junit test,applet ,run time configuration etc.
Now your project is an application so you need to select the android application. If you run your project on first time means it will ask to configure the run time environment. So better you select the run time configuration. After that the new window will appear on that it will show your project you need to select the android Target in the right side of the window tab.
In that target selection mode it contain three option like always prompt to pick device ,Launch on all compatible device  and automatically pick compatible device.
If you already configured the android virtual device it will show the android virtual device in the automatically pick area. If it is not there means no problem check the blog which I posted before about Android Virtual Device Manager.
Once you did then select the device and click apply and Ok

Android Hello World Application

Well on this time onwards we are moving to practical session for better understand. I am going to show you how to create the application in android using the eclipse IDE.In the beginning we will do the small application.
First we need to create the project in android to do that select file and right click that and select new, Android Application Project. At this stage one window will appear and you need to fill the project name and package name and click next, next and finish.
Now you can able to see the project that you created on the package explorer. Now you need to expand the project and you can able to see several folders with the java and xml coding.
In our first application we are going to create the hello world application for this you need to expand the src folder in the application which you created. Double click the MainActivity.java and on the you can able to see the following coding
Package com.example.p1;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.widget.ArrayAdapter;
import android.widget.AutoCompleteTextView;
import android.widget.EditText;
public class MainActivity extends Activity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
    }
    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.activity_main, menu);
        return true;
    }
   
}
In the program android starts with the onCreate method and the class extends the Activity and it contain the bundle and its object. It also contain the setContentView which is used to extends the properties of android Xml file.You can able to get the xml file in the res,layout folder like activity_main.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity" >
    <TextView
        android:id="@+id/textView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerHorizontal="true"
        android:layout_centerVertical="true"
        android:text="@string/hello_world" />
</RelativeLayout>
Xml coding is used to provide the UI for your project.that's it you create the application to run this right click the project which you created and select runas,then select run configuration.
You need to create a run time environment for android, after selecting run-time configuration one new window will appear on that select the target machine. And select always pick the prompt device and once you did click apply and Ok that’s Congratulation you have been created an application in android.

Android Project Explanation

In this time we are going to see the full explanation of the android application project that appear in the package explorer.
Expand the project which you created it contain the list of folders like src,gen,assests,bin,lib,res folder.The src folder is contain the java files.Then the gen folder contain the R.java file which is an non editable file.It will automatically created the files when you create the XML file.
Then it also contain the bin folder that contain the class files and apk of the project which you have been create.The libs folder is used to add the External and Internal library for your project and it also contain the jar files for your project initially it contain the android support jar for your project.
Then the last folder is the res folder,which means the available resources for your android application.It contain the drawable folder like the hdpi,ldpi,mdpi and xdpi these folders contain the various image and varies in sizes like high, low,medium.
It also contain the layout folder which contain the XML file,this file is used for the UI(user interface)of your project.Initially it contain the activity_main.xml.
And it contain the menu folder that also contain the XML file and the values folder is contain the string and style xml files for your application.
I think this is really helpful for your education.

Android Project Creation

   Well on this time we are going to see how to create the project in android.If you want to create an application in android then you need to create an project.Its very simple to create an application in android to do that follow the steps.
     First double click the Eclipse IDE after it open select the File menu in the eclipse.Then it show list of options,on that select the new and it display a  list of options in the pop up now you need to select the android application project.
     Once you select the android application project the new window will appear and it contain the application name,project name,package name.In that type any name for your application then the other fields will automatically filled up,it also contain the minimum and maximum android versions and it also contain the theme then after fill the terms you need select the next button in the bottom.
     After you clicked the next button it will show the configure project and it contain the list of check boxes.The check boxes contain the activity,library and custom launcher icon.Then it also contain the workspace that you want to save your project after these you need to press the next button.
     At this point of stage it will ask the configure launcher icon ,it contain the foreground,foreground scaling,shape and background color for your application.in the foreground option you can browse your own image or you can select the Text or Clipart.the preview tab is also enable in the right side and after that click the next button.
     Well on this time it will ask the create activity and it will show the list of activity like blankactivity,fullscreenactivity,loginactivity,masterdetailflow and settingsactivity and then click the next button.
     And according to the activity the next button option will change and you can able to change the displayed text and after that click the finish button.
     Thats it you create an project and after create the project it will appear in the package explorer.If it is not there means select the window menu and select show view then select the package explorer.
     Now in the package explorer then select the project and expand the android project.Once you expand the project it contain lot of folders,in that folders the src contain the java class and after expand the res folder and select layout that contain the XML files.
     Thats it you create the project in android.

Android Virtual Device Manager

Well in this time we are going to see the android virtual device manager,this is the key for android eclipse IDE you no need an original android device to run the application.Then how is it possible in Eclipse IDE ,it is possible to creates an android virtual device inside the eclipse IDE to do that follow the instruction .
Open the eclipse IDE and goto the window menu,then select the android Virtual Device Manger.Once you have been selected the new window will appear,In that window you can see two tabs one is android virtual device and Device Definition.
Android virtual device is used to create the new device by your device and Device Definition is used to clone the android device and you can pick the device by your wish.
Android virtual device contain the new button it contain the list of android textbox after filling all the boxes click the OK button then it will appear on your PC.Once you create the device you can able to edit,delete and you can see the details.
If you press start then the virtual device will run in your PC.In the device definition simply select the android device and select create AVD.Once you selected the device it automatically appears on android virtual device,if it is not displayed then press the refresh button.
That it you create the android virtual device in your Eclipse IDE.

Android Installation Guide

Well this is entirely based on android season so without speaking anything lets begin the installation process for android.While speaking about the installation process you need certain requirements to build the android workspace.Workspace means we need to create an environment for android to develop the application.
      According to the OS the working environment will varry.
      So the software you need is Android SDK,Android adt,Eclipse IDE and Eclipse plugin these are the software which is used to install android.Before installing this you need the java runtime environment to build the android environment.Android uses most of the syntax of java so java runtime environment is must to install android .
      You can get the Java development Toolkit in the Oracle site once you downloaded the jdk you need to install that but before installing check whether the windows OS is 64 bit or 32 bit and according to the OS you need to download the Jdk bit version.
      After download that you need to install the Jdk and after that you need the following software which i described above,download the software and install all the software in the same folder and once you done android extract the android adt,android SDK,and Eclipse IDE.And after extracting the software you need to install the plugin inside the eclipse IDE to do that double click the eclipse IDE and then it will open with the welcome screen after that you need to install android plugins.
      To do that goto Help and select install new software,after that new window will appear in that window you can see the work with label with the text box on that text box paste this https://dl-ssl.google.com/android/eclipse/ .
       In the name tab check the developer option click the next button and click finish and after few minuties you complete the task.
      After that you need to install the necessary tools by using the sdk manager,to do that you need to go to window menu in the eclipse IDE and then you need to go SDK manager and install the tools of android.Check all the box and select install button and wait for few minutes and after that its all done.
      Now its time to create an application.

Android Start Up and Founder

Android is a open source any one can get the source code and alter the code then they can be placed their application in Google play.Android OS is mainly introduced for mobile but now a days it is implemented in TV, televisions , cars , and wrists . The OS uses touch inputs that loosely correspond to real-world actions, like swiping, tapping, pinching, and reverse pinching to manipulate on-screen objects.
     The wrist watch is an amazing technology which contain the android OS and that synchronize with your android mobile.
     Well while speaking about android development android was introduced by Andy Rubin in the Year 2003 at Palo Alto California .Andy Rubin is the senior vice president of mobile and digital content at Google.
     His invention on android is mind blowing ,android contain  the linux Kernel and its entirely an open source.He uses the basic syntax of C,C++ and Java to develop the android.Now android is also an programming language.
     Google provides the developers to place their own android application in Google Play to earn money.So many people where creating their own app and placing in Google Play store.
The language is interesting ,it contain various visual effects, it contain the XML to create the UI and the Java Code to process in the Backend.
     The success of android is mainly because of the Logo,they created to attract the people,These where the  short description of android

Android Season Begins

As per our viewers suggestions,From on the upcoming blogs we are going to provide and discuss some useful concepts in android,it may be useful for your android application development.These set of tutorial is used to entirely provide the full internal core details of android information and Whatever doubts you have! we  are free to answer the questions within 24 hours for surely.Do you want to know the internal details of android Lets Begin!

Lets begin with the introduction of Android and its versions.

    Android is the mobile operating system with the Linux Kernel and it begin with the beta version in the year 2007, And its under the "Google and Open Handset Alliance".It start with the version 1.0 called android alpha and the growth of android is tremendous in the last 5 years,now its reach the latest version of android 5.0 Lollipop OS.For every version they are providing some improvements in the GUI(Graphical User Interface) and on this time they concentrated more on their Security by encrypting all their files.

Android is mainly introduced for smart screens, but now a days android has been implemented for the ModBus communication ,Real time integration and mostly all electronic Equipment's.that is because of the attractive UI and also its flexibility of the OS by providing the high end process.

Android version is also marked as an important role in the universe to set the trend mark.Its not a Technological name! its nor a psychology name,Its different! While speaking about the android versions totally 12 version has been announced they are

  • Android alpha (1.0)
  • Android beta (1.1)
  • Cupcake (1.5)
  • Doughnut (1.6)
  • Eclair (2.0–2.1)
  • Froyo (2.2–2.2.3)
  • Gingerbread (2.3–2.3.7)
  • Honeycomb (3.0–3.2.6)
  • Ice Cream Sandwich (4.0–4.0.4)
  • Jelly Bean (4.1–4.3.1)
  • KitKat (4.4–4.4.4)
  • Android 5.0 Lollipop  
    We just provide the sample tutorial Hope you cleared see our next topic.

Wednesday, 9 July 2014

Windows 7 Driver installation and upgradation in android mobile

Installing the USB driver on your windows PC for first time its always been trouble but Do you want to know how to install the Drivers within few steps? 
 
To install the Android USB driver on Windows 7 for the first time:
Now it is possible to install windows 7 in android mobile to do that follow the steps
  • Connect your Android-powered device to your computer's USB port.
  • Right-click on Computer from your desktop or Windows Explorer, and select Manage.
 
 
  • Select Devices in the left pane.
 
 
  • Locate and expand Other device in the right pane.
  • Right-click the device name (such as Nexus S) and select Update Driver Software. This will launch the Hardware Update Wizard.
  • Select Browse my computer for driver software and click Next.
  • Click Browse and locate the USB driver folder. (The Google USB Driver is located in <sdk>\extras\google\usb_driver\.)
  • Click Next to install the driver.

Or, to upgrade an existing Android USB driver on Windows 7 with the new driver:
  • Connect your Android-powered device to your computer's USB port.
  • Right-click on Computer from your desktop or Windows Explorer, and select Manage.
  • Select Device Manager in the left pane of the Computer Management window.
  • Locate and expand Android Phone in the right pane.
  • Right-click Android Composite ADB Interface and select Update Driver. This will launch the Hardware Update Wizard.
  • Select Install from a list or specific location and click Next.
  • Select Search for the best driver in these locations; un-check Search removable media; and check Include this location in the search.
  • Click Browse and locate the USB driver folder. (The Google USB Driver is located in <sdk>\extras\google\usb_driver\.)
  • Click Next to upgrade the driver.
 
Hope you got some ideas!

Java path settings

Most of the software are in need of java runtime environment to run the software with any malfunctions.So Do you want to set Java Path? lets begin with simple steps,You need to copy the path of your java bin folder.

Once you copy the file,then right click the My Computer and go to properties


Now you can able to see the new prompt,select Advance system settings option!

The newly displayed prompt must have an Advanced option,select the option and you can able to see the "Environment Variable".


Once your selected the option! it will open another window with the Option of Use Variable for Welcome and System Variable,Select Use Variable for Welcome and click the Add button Now you need to type the variable name as PATH and variable value is the path you have been copied from your C-Drive.

 


Now it's time to click the OK button to set the variable value for Your System.Do you want to set the JAVA_HOME also? then you need to follow this instructions also.

The variable Java Home, generally written as JAVA_HOME, is set to the install path of Java. Learning how to set JAVA_HOME in Windows and Linux isn't hard to do.
Assuming that the path for the Java Development Kit (JDK) during installation is not changed, it will be in a directory under C:\Program Files\Java. This path will have the JDK, let's assume it has jdk1.6.0_06. So the install path is C:\Program Files\Java\jdk1.5.0_08.
Setting JAVA_HOME using "My Computer":
Right click on the My Computer icon on your desktop and select properties
Click the Advanced Tab
Click the Environment Variables button
Under System Variable, click New
Enter the variable name as JAVA_HOME
Enter the variable value as the install path "C:\Program Files\Java\jdk1.6.0_06"
  •  Click OK
  •  Click Apply Changes
  •  Restart the computer to make sure the changes are  reflected.
Setting JAVA_HOME using command prompt
  • Open command prompt
  • Type the following in the command prompt
    set JAVA_HOME = C:
\Program Files\Java\jdk1.6.0_06
and press enter
The JAVA_HOME is set
For Linux
To set the JAVA_HOME we use .bash_profile which is a start-up script. This particular file is used for commands which runs when the normal user logs in. The steps to set JAVA_HOME are:
  1. Login to your account and open .bash_profile file
    $ vi ~/.bash_profile
  2. If your path is set to /usr/java/jdk1.6.0_06/bin/java, set JAVA_HOME as follows:
    export JAVA_HOME=/usr/java/jdk1.6.0_06 /bin/java
  3. Save and close the file. Logout and login back to see new changes. 
These are the methodologies to set the path for java.Hope You get clear!