Ejemplo n.º 1
0
 @Override
 public boolean onContextItemSelected(MenuItem item) {
   final int position = ((AdapterView.AdapterContextMenuInfo) item.getMenuInfo()).position;
   final Book book = ((LibraryTree) getListAdapter().getItem(position)).getBook();
   if (book != null) {
     return onContextItemSelected(item.getItemId(), book);
   }
   return super.onContextItemSelected(item);
 }
Ejemplo n.º 2
0
 @Override
 public boolean onContextItemSelected(MenuItem item) {
   final int position = ((AdapterView.AdapterContextMenuInfo) item.getMenuInfo()).position;
   final ListView view = (ListView) getTabHost().getCurrentView();
   final Bookmark bookmark = ((BookmarksAdapter) view.getAdapter()).getItem(position);
   switch (item.getItemId()) {
     case OPEN_ITEM_ID:
       gotoBookmark(bookmark);
       return true;
     case EDIT_ITEM_ID:
       final Intent intent = new Intent(this, BookmarkEditActivity.class);
       startActivityForResult(intent, 1);
       // TODO: implement
       return true;
     case DELETE_ITEM_ID:
       bookmark.delete();
       myThisBookBookmarks.remove(bookmark);
       AllBooksBookmarks.remove(bookmark);
       mySearchResults.remove(bookmark);
       invalidateAllViews();
       return true;
   }
   return super.onContextItemSelected(item);
 }