Tuesday, September 4, 2012

Creating Your First Android Project

Before starting creating android application you must have setup environment for android development.
I hope that you have already  done that if not then do it  by following this link .

Creating a new Android Project in Eclipse  

1: Click On File  ->  New -> Project
         you will see a dialog, click on  Android Project  See picture


  2: Click on Next  button.
  3: Write the name your project or application . Here for this project I am using "My First App"
 4: Click on Next   choose a target
 5: Click on next.
  
          You see following dialog.   Fill in the fields:  see  picture

 
 Click on Finish buttton.

Your project named "My First App" is created and you can see in left pane under Package Explorer.
You will see some folders that are automatically created like Gen, Res,bin, Src etc.

Now you have to edit your main.xml file.

Editing  main.xml file

1.  Double click on"Res" folder in left pane under Package Explorer.
2. Double Click on "Layout"
3. click on main.xml.
modify the  main.xml file , it should look like( you can just copy this and paste in main.xml)

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >

    <TextView
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="My First Android Application" />

</LinearLayout>




FirstActivty.java 



public class FirstActivty.java extends Activity
{

           @Override
            protected void onCreate(Bundle savedInstanceState)
            {
                       super.onCreate(savedInstanceState);
                      setContentView(R.layout.main);

           }
}

Now right click on your project name and select "Run As"  then click on "Android Application".

It will start the emulator, wait for the emulator to show the output.
You will see following

 Hence you have created your first Android Application..

I have tried to make the things clear  hope you enjoyed it.
Comments are welcome.


6 comments:

  1. THANKS FOR THE BASIC START UP FOR A NEW BEGINNER

    ReplyDelete
  2. Thanks for this post. I dint know it was so easy for starting

    ReplyDelete
  3. Thanks a lot. i like ur instruction.

    ReplyDelete
  4. its easy to follow

    ReplyDelete
  5. Thanks a lot,good example for BEGINNER

    ReplyDelete
  6. when i was created my first project at that time i was get error in manifest.xml file related to theme and in src and gen directory i was not get any file like R.java. so how can i solve this problem?

    ReplyDelete