@NonNull
    private List<Pair<Integer, String>> findContacts(@NonNull final String searchName, final Uri uri, @NonNull final String idColumnName, @NonNull final String selectionColumnName, final boolean like) {
        final String[] projection = {idColumnName, selectionColumnName, ContactsContract.Contacts.DISPLAY_NAME};
        final String selection = selectionColumnName + (like ? " LIKE" : " =") + " ? COLLATE NOCASE";
        final String[] selectionArgs = {like ? "%" + searchName + "%" : searchName};

        final List<Pair<Integer, String>> result = new ArrayList<>();
        try (Cursor cursor = activity.getContentResolver().query(uri, projection, selection, selectionArgs, null)) {
            while (cursor != null && cursor.moveToNext()) {
                final int foundId = cursor.getInt(0);
                final String foundName = cursor.getString(1);
                final String displayName = cursor.getString(2);
                result.add(new Pair<>(foundId, StringUtils.isNotEmpty(displayName) &&
                        !StringUtils.equalsIgnoreCase(foundName, displayName) ? foundName + " (" + displayName + ")" : foundName));
            }
        } catch (final Exception e) {
            Log.e("ContactsHelper.findContacts", e);
        }
        return result;
    }
opens contact card for given user nickname. Caller has to ensure that necessary permissions exist
main/src/main/java/cgeo/geocaching/contacts/ContactsHelper.java