當前位置: 首頁>>代碼示例>>Java>>正文


Java NumberParseException.printStackTrace方法代碼示例

本文整理匯總了Java中com.google.i18n.phonenumbers.NumberParseException.printStackTrace方法的典型用法代碼示例。如果您正苦於以下問題:Java NumberParseException.printStackTrace方法的具體用法?Java NumberParseException.printStackTrace怎麽用?Java NumberParseException.printStackTrace使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.google.i18n.phonenumbers.NumberParseException的用法示例。


在下文中一共展示了NumberParseException.printStackTrace方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: sendOTPNumber

import com.google.i18n.phonenumbers.NumberParseException; //導入方法依賴的package包/類
private void sendOTPNumber(){
	if(checkNull()){
		PhoneNumberUtil util = PhoneNumberUtil.getInstance();
		// assuming you only a button in your layout...
		boolean isAuthentic = false;
		try {
			PhoneNumber number = util.parse(countryPrefix + edtMobile.getText().toString().trim(), countryIso);
			isAuthentic = true;
		} catch (NumberParseException e) {
			e.printStackTrace();
		}
		if (isAuthentic) {
			comman.hideSoftKeyBoard(context, edtMobile);
			createJson(edtMobile.getText().toString().trim(), countryPrefix, countryName);
		}
	}
}
 
開發者ID:mityung,項目名稱:XERUNG,代碼行數:18,代碼來源:SignIn.java

示例2: isValidNumberInE164Format

import com.google.i18n.phonenumbers.NumberParseException; //導入方法依賴的package包/類
public boolean isValidNumberInE164Format(String number) {
  final PhoneNumberUtil phoneNumberUtil = PhoneNumberUtil.getInstance();

  Phonenumber.PhoneNumber phoneNumber = null;

  int country;
  try {
    phoneNumber = phoneNumberUtil.parse(number, "");
    country = phoneNumber.getCountryCode();
  } catch (NumberParseException e) {
    e.printStackTrace();
    return false;
  }

  return phoneNumberUtil.isValidNumberForRegion(phoneNumber,
      phoneNumberUtil.getRegionCodeForCountryCode(country));
}
 
開發者ID:Aptoide,項目名稱:aptoide-client-v8,代碼行數:18,代碼來源:ContactUtils.java

示例3: getPhoneNumber

import com.google.i18n.phonenumbers.NumberParseException; //導入方法依賴的package包/類
/**
 * Uses libphonenumber library to fetch a {@link PhoneNumber} object, from
 * a full phone number inclusive of country telephone prefix. Works best
 * by supplying a string without plus and hyphen characters in my experience.
 * 
 * @param phoneNumber	String
 * @return number		{@link PhoneNumber}
 * 
 * @see <a href="https://github.com/googlei18n/libphonenumber">https://github.com/googlei18n/libphonenumber</a>
 */
public PhoneNumber getPhoneNumber(String phoneNumber) {
	PhoneNumberUtil util = PhoneNumberUtil.getInstance();
	PhoneNumber number = null;
	try {
		number = util.parse(phoneNumber, getDefaultCountryIso());
	} catch (NumberParseException e) {
		e.printStackTrace();
	}
	return number;
}
 
開發者ID:mityung,項目名稱:XERUNG,代碼行數:21,代碼來源:CountryMaster.java

示例4: validatePhone

import com.google.i18n.phonenumbers.NumberParseException; //導入方法依賴的package包/類
public static boolean validatePhone(String phone) {
    PhoneNumberUtil phoneUtil = PhoneNumberUtil.getInstance();
    try {
        Phonenumber.PhoneNumber number = phoneUtil.parse(phone, Locale.getDefault().getCountry());
        return phoneUtil.isValidNumber(number);
    } catch(NumberParseException e) {
        e.printStackTrace();
        return false;
    }
}
 
開發者ID:jpelgrom,項目名稱:Movie-Notifier-Android,代碼行數:11,代碼來源:UserValidation.java

示例5: sanitizeNumber

import com.google.i18n.phonenumbers.NumberParseException; //導入方法依賴的package包/類
/**
 * Santizies a phone number, stripping out any extensions and country codes.
 *
 * WARNING: If you then try to send a text to this number (and it was international),
 * the text will not send. The country code was stripped out.
 */
private String sanitizeNumber(String phoneNumber) {
    PhoneNumberUtil phoneUtil = PhoneNumberUtil.getInstance();
    try {
        Phonenumber.PhoneNumber numberProto = phoneUtil.parse(phoneNumber, Locale.getDefault().getCountry());
        return Long.toString(numberProto.getNationalNumber());
    } catch (NumberParseException e) {
        e.printStackTrace();
    }
    return phoneNumber;
}
 
開發者ID:Xlythe,項目名稱:AndroidTextManager,代碼行數:17,代碼來源:TextManager.java

示例6: internationalNumber

import com.google.i18n.phonenumbers.NumberParseException; //導入方法依賴的package包/類
/**
 * Private Section
 */
public String internationalNumber(String strPhoneNumber, String strDefaultRegion) {
    PhoneNumberUtil phoneUtil = PhoneNumberUtil.getInstance();
    PhoneNumber phoneNumber = new PhoneNumber();

    try {
        phoneNumber = phoneUtil.parse(strPhoneNumber, strDefaultRegion);
    } catch (NumberParseException e) {
        e.printStackTrace();
    }
    strPhoneNumber = phoneUtil.format(phoneNumber, PhoneNumberUtil.PhoneNumberFormat.INTERNATIONAL);
    main.Status.print("Changed to international number format: " + strPhoneNumber);

    return strPhoneNumber;
}
 
開發者ID:somedevelopment,項目名稱:CardDAVSyncOutlook,代碼行數:18,代碼來源:Contact.java

示例7: isValidPhoneNumber

import com.google.i18n.phonenumbers.NumberParseException; //導入方法依賴的package包/類
public static boolean isValidPhoneNumber(String number) {
	boolean result = false;
	try {
		PhoneNumber phoneNumber = parse1(number);
		result = phoneUtil.isValidNumber(phoneNumber);
	} catch (NumberParseException e) {
		e.printStackTrace();
	}
	return result;
}
 
開發者ID:pengjieran,項目名稱:OpenTools,代碼行數:11,代碼來源:PhoneNumberHelper.java


注:本文中的com.google.i18n.phonenumbers.NumberParseException.printStackTrace方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。