Android getMaxAddressLineIndex returns 0 for line 1

后端 未结 4 2107
忘掉有多难
忘掉有多难 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:31

    The same happened to me. I verified that Developer Reference (https://developer.android.com/reference/android/location/Address.html#getMaxAddressLineIndex()) now states:

    int getMaxAddressLineIndex ()

    Returns the largest index currently in use to specify an address line. If no address lines are specified, -1 is returned.

    So it seems to reflect the new behaviour.

    Anyway, to be safe, I'm going to enclose getAddressLine(i) inside try\catch

提交回复
热议问题