Example usage for android.database CursorWrapper getString

List of usage examples for android.database CursorWrapper getString

Introduction

In this page you can find the example usage for android.database CursorWrapper getString.

Prototype

@Override
    public String getString(int columnIndex) 

Source Link

Usage

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   w  w  w.  j  a v a 2s. 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 ww.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;
        }
    });
}