Skip to content

Instantly share code, notes, and snippets.

@sakurabird
Created July 10, 2012 14:30
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sakurabird/3083641 to your computer and use it in GitHub Desktop.
Save sakurabird/3083641 to your computer and use it in GitHub Desktop.
AndroidAnnotationsライブラリーを使ったHello World!
http://androidannotations.org/
すっきりコードを書けるライブラリー
ダウンロードは
https://github.com/excilys/androidannotations/wiki/Download
jarをlibsフォルダにコピーしてビルドパスで参照する
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.yochiand.myexampleandroidannotations"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="3" />
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name" >
<activity
android:name=".MainActivity_"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/hello" />
</LinearLayout>
package com.yochiand.myexampleandroidannotations;
import com.googlecode.androidannotations.annotations.EActivity;
import com.googlecode.androidannotations.annotations.Fullscreen;
import com.googlecode.androidannotations.annotations.NoTitle;
import android.app.Activity;
@NoTitle
@Fullscreen
@EActivity(R.layout.main)
public class MainActivity extends Activity {
}
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="hello">Hello World, MainActivity!</string>
<string name="app_name">MyExmpleAndroidAnnotations</string>
</resources>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment