private void setUpAdapter() {
    Cursor cursor1 =
        getActivity()
            .getContentResolver()
            .query(Card.CONTENT_URI, Card.projection, null, null, Card.CODE);
    // Cursor cursor2 = getActivity().getContentResolver().query(Card.CONTENT_URI, Card.projection,
    // Card.CODE + " IS NULL", null, null);
    // Cursor [] cursors = new Cursor [] {cursor1, cursor2};
    // MergeCursor merge = new MergeCursor(cursors);
    getActivity().startManagingCursor(cursor1);
    // the desired columns to be bound
    String[] columns = new String[] {Card.NAME, Card.DESCRIPTION};
    int[] to = new int[] {R.id.name_entry, R.id.number_entry};
    // create the adapter using the cursor pointing to the desired data as well as the layout
    // information
    mAdapter =
        new CompanyCursorAdapter(getActivity(), R.layout.list_example_entry, cursor1, columns, to);
    // set this adapter as your ListActivity's adapter

    this.setListAdapter(mAdapter);
    mAdapter.setCursorToStringConverter(
        new CursorToStringConverter() {
          public String convertToString(android.database.Cursor cursor) {
            // Get the label for this row out of the "state" column
            final int columnIndex = cursor.getColumnIndexOrThrow("name");
            final String str = cursor.getString(columnIndex);
            Log.d(TAG, "string filter  + " + str);
            return str;
          }
        });

    mAdapter.setFilterQueryProvider(
        new FilterQueryProvider() {
          public Cursor runQuery(CharSequence constraint) {
            // Search for states whose names begin with the specified letters.
            String con = constraint.toString();
            Log.d(TAG, "constraint  + " + con);
            Cursor cursor =
                getActivity()
                    .getContentResolver()
                    .query(
                        Card.CONTENT_URI,
                        Card.projection,
                        Card.NAME + " LIKE ?",
                        new String[] {con + "%"},
                        null);
            getActivity().startManagingCursor(cursor);
            if (cursor.getCount() < 1) {
              Log.d(TAG, "filtering cursor is empty ");
            } else {
              cursor.moveToFirst();
              Log.d(TAG, "filtering cursor = " + cursor.getString(cursor.getColumnIndex("name")));
            }
            return cursor;
          }
        });
  }