当前位置: 首页>>代码示例>>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;未经允许,请勿转载。