Format Phone Number Android

public static String formatPhone(String Phone) {
String formattedNumber = null;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
formattedNumber = PhoneNumberUtils.formatNumberToE164(Phone, "ID");
}
return formattedNumber;
}

ID is my ISO Code, u can get it manually in here

in code:

* But you shoud UpperCase the result, default ISO Code is case sensitive.

TelephonyManager tm = (TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE);
String countryCode = tm.getSimCountryIso();