Android getMaxAddressLineIndex returns 0 for line 1

后端 未结 4 2106
忘掉有多难
忘掉有多难 2021-02-13 05:43

For some reason the implementation of getMaxAddressLineIndex has recently changed. Now this method returns 0 for line 1.

I have an existing code, which used to work: <

4条回答
  •  囚心锁ツ
    2021-02-13 06:22

    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) {}
    }
    

    Hope this help

提交回复
热议问题