==Android Hello World チュートリアル==
[[Android][Eclipse][Java]]
*http://developer.android.com/resources/tutorials/hello-world.html
|}
<<blockquote>>「Build Target」 選択したプラットフォームがAndroid 1.1 プラットフォームを使うということは、アプリケーションが Android 1.1 プラットフォームライブラリに向けてコンパイルされることを意味する。もし、Android 1.5 プラットフォーム上で、1.1で作成されたAVDを走らせる場合、Build Target をあわせる必要はないAndroid アプリケーションは、前方互換性を持っており、1.1 向けにビルドされたアプリケーションは、通常1.5でも起動する。逆は、成り立つわけではない。<</blockquote>>
===プロジェクト準備完了===
*プロジェクトの準備は以上で感rひょう。
*上記が、UIの生成にAndroidではXMLによるレイアウトファイルという代替方式を提供する理由
<<?xml version="1.0" encoding="utf-8"?>> <<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:text="@string/hello"/>>
*Android XML レイアウトファイルの一般的な構造は簡単
*内容を以下の XML に置き換える。
<<?xml version="1.0" encoding="utf-8"?>> <<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:text="@string/hello"/>>
====strings.xml の編集====
*res/values フォルダの中の strings.xml を開く
*helloを "Hello, Android! I am a string resource!" 変更すると、以下のようになる。
<<?xml version="1.0" encoding="utf-8"?>> <<resources>> <<string name="hello">>Hello, Android! I am a string resource!<</string>> <<string name="app_name">>Hello, Android<</string>> <</resources>>
====HelloAndroid クラスの修正====
*HelloAndroid クラスを XML レイアウトを利用するように、以下の様に修正