drtimcooper / LatLongToTimezone

Lat/long to timezone mapper in Java. Does not require web services or data files - just pure Java or Swift.
MIT License
169 stars 33 forks source link

Doesn't work in Android-Studio #30

Closed BassamxMednini closed 5 years ago

BassamxMednini commented 5 years ago

I added the file to my project, unfortunately it doesn't work. I get the error

error: cannot find symbol method initPolyArray()

Any ideas what I can do? It would be great if someone update the README-file, especially for Android-Developer.

BassamxMednini commented 5 years ago

Okay, the error is now gone. It was a mistake from me.

For those who use Kotlin: Create a Java class calls TimezoneMapper, copy & paste this file, remove package com.skedgo.converter; and replace it with your package (Don't forget the semicolon). In your MainActivity add this:

val resultTimeZone = TimezoneMapper.latLngToTimezoneString(YOUR_LATITUDE, YOUR_LONGITUDE)
Log.i("", resultTimeZone)

Now you should see the TimeZone (open Logcat).

It works really great. Even small villages in Tunisia can be found. Thanks for that :)