Code example for CursorAdapter

Methods: getFilterQueryProvider

0
    /** 
     * Cette méthode sert à rajouter une contrainte dans ContentResolver et de sélectionner les numéros correspondants au match 
     */ 
    @Override 
    public Cursor runQueryOnBackgroundThread(CharSequence constraint) {
        if (getFilterQueryProvider() != null) return getFilterQueryProvider().runQuery(constraint);
        StringBuilder buffer = null;
        String[] args = null;
        if (constraint != null) {
            buffer = new StringBuilder();
            buffer.append("("+ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME + " IS NOT NULL AND " +  ContactsContract.CommonDataKinds.Phone.NUMBER + " IS NOT NULL ) AND ");
            buffer.append("(");
            buffer.append("UPPER(");
            buffer.append(ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME);
            buffer.append(") GLOB ? OR ");
            buffer.append(ContactsContract.CommonDataKinds.Phone.NUMBER);
            //buffer.append(PhoneLookup.NUMBER); 
            buffer.append(" GLOB ?)");
            args = new String[] { constraint.toString().toUpperCase() + "*", constraint.toString() + "*" };
        } 
Experience pair programming with AI  Get Codota for Java