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: <
I think getAddressLine()
has changed. It used to return the various elements of the address in separate calls to ...getAddressLine(0)
, ...getAddressLine(1)
and so on up to getAddressLine(n)
where n
is ...getMaxAddressLineIndex()
.
Now it seems to return the entire address concatenated and comma-separated into the call to ...getAddressLine(0)
, and ...getMaxAddressLineIndex()
always returns zero (if an address is returned, or -1 if no address returned).
For example, in the old version, the lat/long
of the Houses of Parliament in London would return (for the first address returned) 4 address lines:
addressLines=[0:"9748 Abingdon Street",1:"Westminster, London",2:"SW1P 3JY",3:"UK"]
Now it returns one line:
addressLines=[0:"9748 Abingdon St, Westminster, London SW1P 3JY, UK"]
That seems to be what happens to me. I've tried it on a Moto G5 Plus with Android 7 and a Samsung tablet with Android 6. My Android emulators still work the old way. Someone tell me if I've got that wrong!
Note: in the past you could test i < address.getMaxAddressLineIndex()
rather than <=
. This just meant you didn't get the last element, which always seemed to be the abreviated country name (e.g. "USA"). Now that .getMaxAddressLineIndex()
always seems to return zero, that won't work. But note you get "USA" appended to the string returned to .getAddressLine(0)
.