ちょっと開発環境が整ったので、androidの開発を行う。
アンドロイドの実機があるのでせっかくなので
オレオレアプリをつくろうかと、思っている。
そこで、なんとなく、今日構築した環境でぽちぽちしてみる。
覚書。
皮のデザイン
主にxmlを使用してやるらしい。
main.xmlに記述してやれば、アプリ起動時に
main.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="@string/hello" /> <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/app_name" /> </LinearLayout>
こんな感じ
表示に使うストリングは、別のxmlで記述している。
@string/app_name
っていうのは、string.xmlのapp_nameって項目の文字列を使うよ〜って意味。
<?xml version="1.0" encoding="utf-8"?> <resources> <string name="hello">Hello World, ttesaaest!</string> <string name="app_name">test</string> </resources>
こんな感じ。
別にメインのjavaにボタンとか、ストリングとか直接記述すればいいんだけど、再利用したいし、メインは、あんまり汚したくないのでxmlとりあえず、記述しておく。
アクティビティ?
一つの画面で行う操作のことをアクティビティっていうらしい。
複数の画面の操作を連携させるには、アクティビティを二つ以上用意する。
説明は、後日。
"Your project contains error(s),please fix them begore running your application" とか言われる。
http://www.techmaru.net/wordpress/20100730/eclipseerrorsoclean/
eclipse でメニューバーからクリーンすればおk。
Twitter クライアントのソースを読む
http://d.hatena.ne.jp/MonteCut/20110516/1305559656
OSS Twitter クライアントであるAndTweetのソースコードを読んでいく。
つづく。