例外:
引起原因:java.lang.IllegalArgumentException:无法识别日期时间区域 id 'America/New_York'
安卓代码:
DateTime dt = new DateTime();
DateTimeZone dtZone = DateTimeZone.forID("America/New_York");
DateTime dtus = dt.withZone(dtZone);
Date dateInUS = dtus.toDate();
System.out.println(dateInUS);
为什么我会收到此错误?
我已经在 Gradle 中加载了 Joda API:
compile 'net.danlew:android.joda:2.7.1'
我通过添加以下内容解决了该错误:
public void onCreate() {
super.onCreate();
JodaTimeAndroid.init(this);
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)