public void searchUser(final String userName) {

        if (StringUtils.isBlank(userName)) {
            ActivityMixin.showToast(activity, LocalizationUtils.getString(R.string.contact_not_found, userName));
            return;
        }

        // search by nickname, exact
        List<Pair<Integer, String>> contacts = findContacts(userName, ContactsContract.Data.CONTENT_URI, ContactsContract.Data.CONTACT_ID, ContactsContract.CommonDataKinds.Nickname.NAME, false);

        // search by display name, exact
        if (contacts.isEmpty()) {
            contacts = findContacts(userName, ContactsContract.Contacts.CONTENT_URI, BaseColumns._ID, ContactsContract.Contacts.DISPLAY_NAME, false);
        }

        // search by contained name parts
        if (contacts.isEmpty()) {
            contacts.addAll(findContacts(userName, ContactsContract.Data.CONTENT_URI, ContactsContract.Data.CONTACT_ID, ContactsContract.CommonDataKinds.Nickname.NAME, true));
            contacts.addAll(findContacts(userName, ContactsContract.Contacts.CONTENT_URI, BaseColumns._ID, ContactsContract.Contacts.DISPLAY_NAME, true));
        }

        if (contacts.isEmpty()) {
            ActivityMixin.showToast(activity, LocalizationUtils.getString(R.string.contact_not_found, userName));
            return;
        }

        if (contacts.size() > 1) {
            selectContact(contacts);
        } else {
            final int contactId = contacts.get(0).first;
            openContact(contactId);
        }
    }
opens contact card for given user nickname. Caller has to ensure that necessary permissions exist
main/src/main/java/cgeo/geocaching/contacts/ContactsHelper.java