Code example for CursorAdapter

0
    } 
 
    private class SuggestionsAdapter extends CursorAdapter {
 
        public SuggestionsAdapter(Context context, Cursor c) {
            super(context, c, 0);
        } 
 
        @Override 
        public View newView(Context context, Cursor cursor, ViewGroup parent) {
            LayoutInflater inflater = LayoutInflater.from(context);
            View v = inflater.inflate(android.R.layout.simple_list_item_1, parent, false);
            return v;
        } 
 
        @Override 
        public void bindView(View view, Context context, Cursor cursor) {
            TextView tv = (TextView) view;
            final int textIndex = cursor.getColumnIndex(SearchManager.SUGGEST_COLUMN_TEXT_1);
            tv.setText(cursor.getString(textIndex));
        }