android - how make the AutoCompleteTextView adapter find the phoneNumber? -


my adapter search in list of contact phone numbers.

when user starts typing digits in autocompletetextview, number getting formatted...

so looks 050-...

and after more digits, it's changed :(050) 111-11..

so adapter of autocompletetextview couldn't find number ...

(contact-phone-numbers formatting : (050) 555-555-5 , number accept textview 050-11 )

my question: can tell adapter search without non digit characters? don't know function it.

    simplecursoradapter madapter = new simplecursoradapter(...);         madapter.setfilterqueryprovider(new filterqueryprovider(){                 public cursor runquery(charsequence constraint) {                     if (constraint != null) {                         return getactivity().getcontentresolver().query(                 phone.content_uri, new string[]{phone._id, phone.display_name, phone.number, phone.type},                 "replace(" + "replace(" + "replace(" + "replace(" +                 phone.number + ",'(',''),')','')" + ",' ',''),'-','')" +                 " '%" + constraint.tostring().replaceall("\\d", "") + "%'", null, null);                     }                      return getactivity().getcontentresolver().query(                 phone.content_uri, new string[]{phone._id, phone.display_name, phone.number, phone.type},                 null, null, null);                 }             });     mtextview.setadapter(madapter); 

this adapter-function can put replacing non digit code... , filterring on digit, without character.

i try , it's working... hope you...


Comments

Popular posts from this blog

How to provide Authorization & Authentication using Asp.net, C#? -

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

How to use Authorization & Authentication in Asp.net, C#? -