Current post is on how to create your first Android 'Hello Android' Application in Eclipse in Vista
1) Create AVD Emulator
Method:
1. Run 'SDK Setup.exe' from ADK_DWLD_PATH.
2. Select 'Virtual Device' Tab.
3. Select 'New...'.
4. Enter 'Android1.1' (Any name of your choice) in 'Name Field'.
5. Select 'Android 1.1 API Level 2' (Any platform of your choice) in 'Target Field'.
6. Keep rest as default. (You can change as per your requirement)
7. Press 'Create'.
2) Create New Project
Method:
1. Start Eclipse.
2. Select 'File' -> 'New' -> 'Project'.
3. Select 'Android Project' under 'Android'.
4. Press 'Next'
5. Enter 'Project Name' as 'Hello Android'
6. The 'Target Name' will shows all the current platform installed. I selected 'Android 1.1' (Emulator is for API 1.1)*
7. 'Application name' -> 'Hello, Android'.
8. 'Package name' -> 'com.example.helloandroid'.
9. 'Create Activity' -> 'HelloAndroid'.
10. 'Min SDK Version' -> 2 (will be automatically set).
11. Press 'Finish'.
3) Edit the content
Project 'Hello Android' will be created.
Replace the content in 'HelloAndroid.java'.
Code::
package com.android.helloandroid;
import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;
public class HelloAndroid extends Activity
{
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
TextView tv = new TextView(this);
tv.setText("Hello, Android");
setContentView(tv);
}
}
4) Run the Application
Method:
1. Select 'Run' - 'Run'**.
2. Select 'Android Application'***.
Yes. My first application on 'Andriod'.
* - 'Target Name' Empty list Post
** - 'Run Configuration' Post
*** - 'No 'Hello Andriod' ' Post
Appreciate your feedback via comments. Thanks.
No comments:
Post a Comment