Android/APP&SDK2009/04/20 14:59
[출처 : Android]

SDK test App 만들기(eclipse)
O/S : Windows XP
SDK : Android SDK 1.1
eclipse : eclipse 3.4

1. 새로운 프로젝트 생성
File >> New >> Android Project

2. Form 채우기
project name : HelloAndroid
Package name : com.example.hello (or your own private namespace)
Activity name : HelloAndroid
Application name : Hello, Android
Finish.

Project Name
This is the name of the directory or folder on your computer that you want to contain the project.
Package Name
This is the package namespace (following the same rules as for packages in the Java programming language) that you want all your source code to reside under. This also sets the package name under which the stub Activity will be generated.

The package name you use in your application must be unique across all packages installed on the system; for this reason, it's very important to use a standard domain-style package for your applications. In the example above, we used the package domain "com.android"; you should use a different one appropriate to your organization.

Activity Name
This is the name for the class stub that will be generated by the plugin. This will be a subclass of Android's Activity class. An Activity is simply a class that can run and do work. It can create a UI if it chooses, but it doesn't need to.
Application Name
This is the human-readable title for your application.

The checkbox for toggling "Use default location" allows you to change the location on disk where the project's files will be generated and stored.


3. 자동으로 생성된 코드 보기
Class name : HelloAndroid
HelloAndroid >> src >> com.android.hello
package com.example.hello;

import android.app.Activity;
import android.os.Bundle;

public class HelloAndroid extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
    }
}

Construct the UI
package com.android.hello;

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

* TIP
Log 찍기
import android.util.log;

Log.d(Tag Name, Message);

AndroidManifest.xml 수정하기
디버그 모드 설정 -> application -> android:debuggable="true" 등록
추가한 클래스를 <activity> 등록

'Android > APP&SDK' 카테고리의 다른 글

api demos MAP  (0) 2009/06/09
HTC의 안드로이드 홈 UI Rosie  (0) 2009/05/28
create AVD(Android Virtual Device)  (0) 2009/04/29
Hello, World  (0) 2009/04/20
Android SDK Build 방법  (0) 2009/04/14
Android SDK 개발환경 설정  (0) 2009/04/10
Posted by mirwing