我有这个代码:
TypedArray mAllowedCountries = application.getResources().obtainTypedArray(R.array.allowed_countries);
for (int index = 0; index < mAllowedCountries.length(); index++) {
if(mAllowedCountries.getString(index) != null) {
if (mAllowedCountries.getString(index).toUpperCase().equals(addressComponentCountry.short_name.toUpperCase())) {
supported = true;
break;
}
}
}
我收到关于Android Studio Lint的警告
方法调用“toUpperCase”可能会产生“java.lang.NullPointerException”
如何解决此问题以消除Lint警告?