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 .
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>
public class FirstActivty.java extends Activity
{
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
<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.
THANKS FOR THE BASIC START UP FOR A NEW BEGINNER
ReplyDeleteThanks for this post. I dint know it was so easy for starting
ReplyDeleteThanks a lot. i like ur instruction.
ReplyDeleteits easy to follow
ReplyDeleteThanks a lot,good example for BEGINNER
ReplyDeletewhen 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?
ReplyDeleteAivivu chuyên vé máy bay, tham khảo
ReplyDeletevé máy bay đi Mỹ bao nhiêu
lịch bay từ mỹ về việt nam
máy bay đà nẵng
vé máy bay giá rẻ đến nha trang
gia ve may bay phu quoc
Hi,
ReplyDeleteThanks for sharing the information with us it was very informative. Hangup.in
đại lý Japan Airlines tphcm
ReplyDeleteđổi vé máy bay China Airlines
muốn mua thêm hành lý ký gửi Eva Air