Android getMaxAddressLineIndex为第1行返回0 [英] Android getMaxAddressLineIndex returns 0 for line 1
本文介绍了Android getMaxAddressLineIndex为第1行返回0的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
由于某种原因,最近更改了getMaxAddressLineIndex的实现.现在,此方法为第1行返回0.
For some reason the implementation of getMaxAddressLineIndex has recently changed. Now this method returns 0 for line 1.
我有一个可以正常工作的现有代码:i<address.getMaxAddressLineIndex(
).但是,它以某种方式被破坏了.
I have an existing code, which used to work: i<address.getMaxAddressLineIndex(
). However, it is broken somehow.
我不知道这是由于新的Google Api还是其他原因引起的.
I don't know if it is due to the new Google Api or something else.
有人可以在这里确认我发生了什么事吗?
Can someone please confirm me here what is going on?
推荐答案
我遇到了同样的问题,但这只是解决方法.
I had the same issue and this just a workaround.
if (address.getMaxAddressLineIndex() > 0) {
for (int i = 0; i < address.getMaxAddressLineIndex(); i++) {
addressFragments.add(address.getAddressLine(i));
}
} else {
try {
addressFragments.add(address.getAddressLine(0));
} catch (Exception ignored) {}
}
希望获得帮助
这篇关于Android getMaxAddressLineIndex为第1行返回0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文