yaakov
07/04/2018, 12:32 AMJava.lang.IndexOutOfBoundsException: Index: 0, Size: 0
How can I prevent this kind of error? I think the problem comes from here:
val address = geocoder.getFromLocation(it.latitude, it.longitude, 1)
val country = address[0].countryCode.toLowerCase()
fatih.yalmanbas
07/04/2018, 7:20 AMaddress.gerOrNull[0]?.countryCode?.toLowerCase().orEmpty()
val country = if (address.isNotEmpty()) address[0].countryCode.toLowerCase() else ""
fatih.yalmanbas
07/04/2018, 7:20 AM