Pages - Menu

Tuesday 11 September 2012

Creating the First android app


The first android app is the "Hello World" app. Following are the steps for creating the first android app.  Open eclipse IDE and Click  file  ---new -----project---Android Project---next .
Here i give the name of the project as  FirstApp. Note that every project name must start with capital letters only.



 

Press next and here i take the target name 2.2


Press next and set Application Name as FirstApp, package name as com.codeglympse(reverse of       my blog URL ), tick the Create Activity and name it as StartActivity, select the Minimum sdk Version to 8 and press finish.
Now expand the project folder, then expand the res folder then again expand the layout foler.
Double click the main.xml file and you will get the following form in eclipse.
Now click the main.xml tag at the bottom of the form.


In the bellow code, you have to edit only the code segment shown in bold.

<?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="HELLO FROM MY FIRST PROJECT" />
</LinearLayout>


Now run the application.
 Right click the project folder on project explorer and select run as  --- Android application
Output :


No comments:

Post a Comment