Reversegeocodingtask Task To A Method
I grab a code from the android site that do the reverse geocoding (transfering a location from numbers to a text) It's working fine but since my application has changed a bit I nee
Solution 1:
You start by making a method like so
publicStringreverseGeocode(Location loc) {
}
change the line that grabs the first location, being the only one used, and remove it - you already have loc
//Location loc = params[0];
Then instead of setting the address to that location service, just return it:
//LocationService.this.address = addressText;return addressText;
Splice those into the method, remove the unnecessary return statement at the end, and you're golden.
Upon a closer look I'm also seeing an exception you'll simply want to throw up the chain instead of handling inside this method. Let that get handled by whatever calls your method on a case-by-case basis: it's not a problem this method can solve.
Post a Comment for "Reversegeocodingtask Task To A Method"