List of usage examples for android.database CursorWrapper getColumnIndex
@Override public int getColumnIndex(String columnName)
From source file:net.naonedbus.fragment.impl.SearchFragment.java
@Override public void onListItemClick(final ListView l, final View v, final int position, final long id) { final CursorWrapper equipement = (CursorWrapper) getListAdapter().getItem(position); final int idType = equipement.getInt(equipement.getColumnIndex(EquipementTable.ID_TYPE)); Intent intent;/*w ww.jav a 2 s. c om*/ if (idType == Type.TYPE_ARRET.getId()) { intent = new Intent(getActivity(), ParcoursActivity.class); intent.putExtra(ParcoursActivity.PARAM_ID_SATION, (int) id); } else { intent = new Intent(getActivity(), MapActivity.class); intent.putExtra(MapFragment.PARAM_ITEM_ID, id); intent.putExtra(MapFragment.PARAM_ITEM_TYPE, idType); } startActivity(intent); }
From source file:net.naonedbus.fragment.impl.LignesFragment.java
@Override public void onCreateContextMenu(final ContextMenu menu, final View v, final ContextMenuInfo menuInfo) { super.onCreateContextMenu(menu, v, menuInfo); final AdapterView.AdapterContextMenuInfo cmi = (AdapterView.AdapterContextMenuInfo) menuInfo; final CursorWrapper ligne = (CursorWrapper) getListAdapter().getItem(cmi.position); final String lettreLigne = ligne.getString(ligne.getColumnIndex(LigneTable.LETTRE)); final android.view.MenuInflater inflater = getActivity().getMenuInflater(); inflater.inflate(R.menu.fragment_lignes_contextual, menu); menu.setHeaderTitle(getString(R.string.dialog_title_menu_lignes, lettreLigne)); }
From source file:com.morlunk.mumbleclient.channel.ChannelListFragment.java
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { inflater.inflate(R.menu.fragment_channel_list, menu); MenuItem searchItem = menu.findItem(R.id.menu_search); SearchManager searchManager = (SearchManager) getActivity().getSystemService(Context.SEARCH_SERVICE); final SearchView searchView = (SearchView) MenuItemCompat.getActionView(searchItem); searchView.setSearchableInfo(searchManager.getSearchableInfo(getActivity().getComponentName())); searchView.setOnSuggestionListener(new SearchView.OnSuggestionListener() { @Override//from ww w . jav a2 s .c o m public boolean onSuggestionSelect(int i) { return false; } @Override public boolean onSuggestionClick(int i) { CursorWrapper cursor = (CursorWrapper) searchView.getSuggestionsAdapter().getItem(i); int typeColumn = cursor.getColumnIndex(SearchManager.SUGGEST_COLUMN_INTENT_EXTRA_DATA); int dataIdColumn = cursor.getColumnIndex(SearchManager.SUGGEST_COLUMN_INTENT_DATA); String itemType = cursor.getString(typeColumn); int itemId = cursor.getInt(dataIdColumn); if (ChannelSearchProvider.INTENT_DATA_CHANNEL.equals(itemType)) { if (getService().getSessionChannel().getId() != itemId) { getService().joinChannel(itemId); } else { scrollToChannel(itemId); } return true; } else if (ChannelSearchProvider.INTENT_DATA_USER.equals(itemType)) { scrollToUser(itemId); return true; } return false; } }); }
From source file:com.terracom.mumbleclient.channel.ChannelListFragment.java
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { inflater.inflate(R.menu.fragment_channel_list, menu); MenuItem searchItem = menu.findItem(R.id.menu_search); SearchManager searchManager = (SearchManager) getActivity().getSystemService(Context.SEARCH_SERVICE); final SearchView searchView = (SearchView) MenuItemCompat.getActionView(searchItem); searchView.setSearchableInfo(searchManager.getSearchableInfo(getActivity().getComponentName())); searchView.setOnSuggestionListener(new SearchView.OnSuggestionListener() { @Override//from w w w .j a v a2 s . c o m public boolean onSuggestionSelect(int i) { return false; } @Override public boolean onSuggestionClick(int i) { CursorWrapper cursor = (CursorWrapper) searchView.getSuggestionsAdapter().getItem(i); int typeColumn = cursor.getColumnIndex(SearchManager.SUGGEST_COLUMN_INTENT_EXTRA_DATA); int dataIdColumn = cursor.getColumnIndex(SearchManager.SUGGEST_COLUMN_INTENT_DATA); String itemType = cursor.getString(typeColumn); int itemId = cursor.getInt(dataIdColumn); if (ChannelSearchProvider.INTENT_DATA_CHANNEL.equals(itemType)) { try { if (getService().getSessionChannel().getId() != itemId) { getService().joinChannel(itemId); } else { scrollToChannel(itemId); } } catch (RemoteException e) { e.printStackTrace(); } return true; } else if (ChannelSearchProvider.INTENT_DATA_USER.equals(itemType)) { scrollToUser(itemId); return true; } return false; } }); }