Comparing phone numbers in Android

前端 未结 4 1240
故里飘歌
故里飘歌 2020-12-06 11:06

I need to compare two phone numbers to determine if they\'re from the same sender/receiver. The user may send a message to a contact, and that contact may reply.

The

4条回答
  •  眼角桃花
    2020-12-06 11:52

    Android has nice PhoneNumberUtils, and i guess your looking for :

        public static boolean compare (String a, String b)
    

    look in : http://developer.android.com/reference/android/telephony/PhoneNumberUtils.html

    using it should look like this :

    String phone1   
    String phone2 
    
     if (PhoneNumberUtils.compare(phone1, phone2)) {
        //they are the same do whatever you want!
       }
    

提交回复
热议问题