Permalink
Browse files

Updating NoteDetailActivity. #1 #3 #4

  • Loading branch information...
1 parent d260261 commit 91c4cc405325a409c53ee4fd6ac7cb2e7c59cc4a @mayosuke committed Jul 16, 2012
@@ -1,11 +1,12 @@
<menu xmlns:android="http://schemas.android.com/apk/res/android">
- <item android:id="@+id/menu_new_note"
- android:title="@string/menu_new_note"
+ <item android:id="@+id/menu_save_note"
+ android:title="@string/menu_save_note"
android:orderInCategory="100"
- android:icon="@android:drawable/ic_menu_add"
+ android:icon="@android:drawable/ic_menu_save"
android:showAsAction="ifRoom|withText" />
- <item android:id="@+id/menu_settings"
- android:title="@string/menu_settings"
+ <item android:id="@+id/menu_delete_note"
+ android:title="@string/menu_delete_note"
android:orderInCategory="100"
- android:showAsAction="never" />
+ android:icon="@android:drawable/ic_menu_delete"
+ android:showAsAction="ifRoom|withText" />
</menu>
View
@@ -4,6 +4,8 @@
<string name="hello_world">Hello world!</string>
<string name="menu_settings">Settings</string>
<string name="menu_new_note">New note</string>
+ <string name="menu_save_note">Save</string>
+ <string name="menu_delete_note">Delete</string>
<string name="title_activity_main">MainActivity</string>
<string name="title_activity_note_detail">Note Detail</string>
<string name="hint_note_detail">Input note here.</string>
@@ -8,6 +8,7 @@
import android.view.Menu;
import android.view.MenuItem;
import android.widget.EditText;
+import android.widget.Toast;
public class NoteDetailActivity extends Activity {
private static final String TAG = NoteDetailActivity.class.getSimpleName();
@@ -72,6 +73,14 @@ public boolean onCreateOptionsMenu(Menu menu) {
@Override
public boolean onOptionsItemSelected(MenuItem item) {
Log.v(TAG, "onOptionsItemSelected():item=" + item);
+ switch (item.getItemId()) {
+ case R.id.menu_save_note:
+ Toast.makeText(this, "ノートを保存します。", Toast.LENGTH_SHORT).show();
+ break;
+ case R.id.menu_delete_note:
+ Toast.makeText(this, "ノートを削除します。", Toast.LENGTH_SHORT).show();
+ break;
+ }
return super.onOptionsItemSelected(item);
}

0 comments on commit 91c4cc4

Please sign in to comment.