달력

52025  이전 다음

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31

1. android source code (JavaStyle.java)
package com.example.oldstyle;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import java.util.Date;

public class JavaStyle extends Activity implements View.OnClickListener {
 Button btn;
 
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
       
        btn = new Button(this);
        btn.setOnClickListener(this);
        setContentView(btn);
        //setContentView(R.layout.main);
    }
   
    public void onClick(View view) {
     updateTime();
    }
   
    private void updateTime() {
     btn.setText(new Date().toString());
    }
}

2. AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.example.oldstyle"
      android:versionCode="1"
      android:versionName="1.0">
    <application>
        <activity android:name=".JavaStyle">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

    </application>
    <uses-sdk android:minSdkVersion="2" />

</manifest>

'Lecture Notes > Android Basics' 카테고리의 다른 글

안드로이드 프로그램 시작  (0) 2010.07.20
안드로이드 설치 및 개발 환경 구축  (0) 2010.07.20
Default Android Program (Basic)  (0) 2010.06.04
WIPI Basic Program  (0) 2010.06.03
J2ME Basic Program  (0) 2010.06.03
Posted by kingjung
|