ContactsAutoCompleteTextView
ContactsAutoCompleteTextView copied to clipboard
Find contacts by searching 01... when their number is saved with a country code
When searching for a phone number like 0150 123456 the contact should show up, even if its saved as eg. +49 150 123456.
Hehe, my EIST Tutor is perfectly right!
I need to refractor the code one of these days and to fix the issue you're explaining. It'll be in 0.2 ! :+1: :smile:
I need your review on this commit, it solves 75% of the use cases but some are not properly handled like if I type +4916... I won't get 016, but cannot say if many people look for number with country code included. :anguished: :confused:
Why not pattern match it with +XX 1234 / 00XX 1234 / 01234?
Your solution doesn't seem reliable :smirk:
It isn't (I'd have closed the issue if it was...).
How do you handle difference between USA (+1) and Bahamas (+1242) ? Not only european out there :stuck_out_tongue_winking_eye: :wink: :warning:
To have a proper overview of the complexity of the problem: https://en.wikipedia.org/wiki/List_of_country_calling_codes
Hm, difficult one^^
In this case you're right, probably no one will enter a number with country code. You might even limit the input field to numbers only to prevent the user from making this "mistake" :stuck_out_tongue_winking_eye:
OK, I think I found a reliable solution: what do you think of a view which splits itself at runtime in two views (one for the country code and one for the rest) if the user types a +
or a 00
(and if a letter comes after the 00
, it'll be reassembled because it's then a name or a email).
I need a bit of time to make it properly but I think it is the best not-complex solution.
What is your opinion on that?
Hi lolobosse,
How to get phone number, I try to use textview.getName() but it return null. I also try to use textview.getText().toString() after pick a contact, but it just return a name, not return a phone number. Please help, thanks.