Using PhoneNumberUtils.formatNumber() on API 16

后端 未结 3 1414
孤城傲影
孤城傲影 2021-02-19 12:37

I\'m trying to format numbers to a default country code, and I know how, but when I do it, an error appears saying this is only for API 21. I am targeting API 16. If I use the o

3条回答
  •  一生所求
    2021-02-19 12:40

    This works for me for all version, may be because of backward compatibility support:

    yourTextView.setText(PhoneNumberUtils.formatNumber(yourStringPhone, Locale.getDefault().getCountry()));
    

提交回复
热议问题