Thursday, December 10, 2009

'Hello Android' Android Application on Vista

Current post is on how to create your first Android 'Hello Android' Application in Eclipse in Vista


As in previous post, we setup the things, now it's time to get dirty, i mean start development.

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

Disclaimer:

The above post and all the posts in the blog are derived from facts, information, logical interpretation and logical conclusion of printed and internet materials available to me, perceived and produced by 99 gm brain of mine, which by no means always be accurate, consistent and complete.

All the posts are for personal quick reference only.

If any suggestion, correction, misinterpretation, misconception commented, which will be moderated and deleted if required, to avoid unforeseen issues.

If any trademark / copywrite issue is present, do send in a mail and appropriate tag (logo, name, website link) will be attached to the same.

Additional disclaimer will be attached wherever required in the post.