Taking a Peek
In the sample project at http://apress.com/, you will find an amended version of the sample () with an associated menu. Since the menus are defined in Java code, the XML layout need not change and is not reprinted here.
However, the Java code has a few new behaviors, as shown here:
Public class extends
Public static final
Public static final
Public static final
Public static final
Public static final
Public static final
Public static final
Public onCreate
Super onCreate
SetContentView
SetListAdapter new this
FindViewById
RegisterForContextMenu getListView
Public onListItemClick
SetText
Public onCreateContextMenu
PopulateMenu
Public onCreateOptionsMenu
PopulateMenu
Return super onCreateOptionsMenu
Public onOptionsItemSelected
Return applyMenuChoice
Super onOptionsItemSelected
Public onContextItemSelected
Return applyMenuChoice
Super onContextItemSelected
Private populateMenu
Add
Add
Add
Add
Add
Add
Add
Private applyMenuChoice
Switch getItemId
Case
GetListView setDividerHeight
Return true
Case
GetListView setDividerHeight
Return true
Case
GetListView setDividerHeight
Return true
Case
GetListView setDividerHeight
Return true
Case
GetListView setDividerHeight
Дата добавления: 2015-05-16; просмотров: 748;