SDK 1.5_r2 버전의 sample 로 제공되는 NotePad application을 보고있습니다.
onCreateOptionsMenu 메서드 내의 intent 정의부분인데요. intent 에 대한 정리가 잘 안되어 있는지 무슨의미 인지 모르겠습니다.
--------------------------------------------------------------------------------------------------
@Override
public boolean onCreateOptionsMenu(Menu menu) {
super.onCreateOptionsMenu(menu);
// This is our one standard application action -- inserting a
// new note into the list.
menu.add(0, MENU_ITEM_INSERT, 0, R.string.menu_insert)
.setShortcut('3', 'a')
.setIcon(android.R.drawable.ic_menu_add);
// add by JUDE
menu.add(0,MENU_CONTACT_LIST, 0, R.string.menu_clist).setIcon(android.R.drawable.ic_menu_call);
// Generate any additional actions that can be performed on the
// overall list. In a normal install, there are no additional
// actions found here, but this allows other applications to extend
// our menu with their own actions.
Intent intent = new Intent(null, getIntent().getData());
intent.addCategory(Intent.CATEGORY_ALTERNATIVE);
menu.addIntentOptions(Menu.CATEGORY_ALTERNATIVE, 0, 0,
new ComponentName(this, NotesList.class), null, intent, 0, null);
return true;
}
-----------------------------------------------------------------------------------------------------------------------
붉게 칠한 부분이 알고 싶은부분입니다. 뭔가 해서 4줄다 주석처리 해보았는데, 노트패드에서 제목편집, 내용편집, 새로 추가, 삭제 등 기능에 아무런 변화가 없고 오류도 없습니다. 그렇게 따지면 무의미한 코드라는 건데.. 주석도 잘 이해가 안가고...
아시는 분의 답변 부탁드리겠습니다.
감사합니다.
붉은 칠한 부분은 동적메뉴 생성에 관한 코드 입니다.
edit 화면에서 메뉴 버튼 누르면 원래 revert, delete, edit title 요렇게 3개의 메뉴가 보이는데
주석하면 edit title 메뉴가 사라집니다.