public Intent getActionIntent() { Intent intent = null; if (type == Type.LINK) { intent = new Intent(Intent.ACTION_VIEW); String url = text; if (!url.startsWith("http")) { url = "http://" + url; } intent.setData(Uri.parse(url)); } else if (type == Type.MAP) { intent = new Intent( android.content.Intent.ACTION_VIEW, Uri.parse("google.navigation:q=" + text)); } else if (type == Type.PHONE) { String number = PhoneNumberUtils.stripSeparators(text); intent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:" + number)); } else if (type == Type.APP_LINK) { intent = place.getAppLinkIntent("Facebook"); } return intent; } }
@Override public void onClick(View v) { String phoneNumber = place.get(Place.PHONE); if (phoneNumber != null) { String strippedNumber = PhoneNumberUtils.stripSeparators(phoneNumber); Intent intent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:" + strippedNumber)); listener.onCallPhone(intent); } } });
/** * @return the unformatted mobile number entered by the user */ public String getMobileNumber() { return PhoneNumberUtils.stripSeparators(getText().toString()); }
@Override public boolean isValid(@Nullable CharSequence value) { return value != null && PhoneNumberUtils.isGlobalPhoneNumber( PhoneNumberUtils.stripSeparators(value.toString())); } };
@Override public boolean isValid(@Nullable CharSequence value) { return value != null && PhoneNumberUtils.isGlobalPhoneNumber( PhoneNumberUtils.stripSeparators(value.toString())); } };
public static boolean handleChars(Context context, String input, EditText textField) { //get rid of the separators so that the string gets parsed correctly String dialString = PhoneNumberUtils.stripSeparators(input); if (handleDeviceIdDisplay(context, dialString) || handleRegulatoryInfoDisplay(context, dialString) || handlePinEntry(context, dialString) || handleAdnEntry(context, dialString, textField) || handleSecretCode(context, dialString)) { return true; } return false; }