==Android Notepad チュートリアル==
[[Android][Java][Eclipse]]
*http://developer.android.com/resources/tutorials/notepad/index.html
=====すべての Android のXMLレイアウトのヘッダーは以下で始まらなければいけない=====
<<?xml version="1.0" encoding="utf-8"?>>.
=====次に、たいていの場合、以下の様なレイアウトを置く=====
LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
===LinearLayout ===
<<?xml version="1.0" encoding="utf-8"?>> <<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content">> <<ListView android:id="@android:id/list"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>> <<TextView android:id="@android:id/empty"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/no_notes"/>> <</LinearLayout>>
===行のレイアウト===
====notes_row.xml====
*res/layout に notes_row.xml を作成
<<?xml version="1.0" encoding="utf-8"?>> <<TextView android:id="@+id/text1"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>>
===Notepadv1 クラスの編集===
*fillData() はまだ未作成
====onCreateOptionsMenu()====
<<?xml version="1.0" encoding="utf-8"?>> <<resources>> <<string name="app_name">>Notepad v1<</string>> <<string name="no_notes">>No Notes Yet<</string>> <<string name="menu_insert">>Add Item<</string>> <</resources>>
===AndroidManifest.xml の編集===
*<<activity android:name=".NoteEdit"><></activity>>を追加
<<activity android:name=".Notepadv2" android:label="@string/app_name">>
:
<</activity>> <<activity android:name=".NoteEdit"><></activity>>
===ここまでで起動===
if (mRowId == null) {
long id = mDbHelper.createNote(title, body);
if (id > > 0) {
mRowId = id;
}