List of usage examples for android.database CursorWrapper getInt
@Override public int getInt(int columnIndex)
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;//from w w w . ja va 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: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. j av a 2 s. co 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/*w w w . j a v a 2 s .c om*/ 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; } }); }