2010년 4월 11일 일요일

Android of the beginner 1

1. Environment setting
1) android-sdk_r05-windows.zip Download from http://developer.android.com/sdk/index.html

2)  Eclipse(ganymede)  >  help > softwareupdate > http://dl-ssl.google.com/android/eclipse/ > install

3) console window open in setting fold >

4) New Project > Android Project > MobilePlace Lecture

5)/MobilePlace Lecture/src/kr/mobileplace/lecture/MyActivity.java
package kr.mobileplace.lecture;

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

public class MyActivity extends Activity {

@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.myactivity);
Log.d("MyTag", "Print Test Log");
}
}

6) /MobilePlace Lecture/res/layout/myactivity.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    >
<TextView  
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:text="Let's android"
    />
</LinearLayout>

7) /MobilePlace Lecture/AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="kr.mobileplace.lecture"
      android:versionCode="1"
      android:versionName="1.0">
    <application android:icon="@drawable/icon" android:label="@string/app_name">
        <activity android:name=".Main"
                  android:label="@string/app_name">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
<activity android:name=".MyActivity" android:label="My Activity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
            </intent-filter>
        </activity>
    </application>
</manifest>

8) Run > Run Configuration

9) Result : Wait over one minute, it's long time. Look for the your result, MENU click!!!

Reference http://www.androidpub.com/

댓글 없음:

댓글 쓰기