Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private class LocTask extends AsyncTask<Double, Void, List<Address>> {
- @Override
- protected List<Address> doInBackground(Double... params) {
- try {
- return geoCoder.getFromLocation(params[0], params[1], 1);
- } catch (IOException e) {
- e.printStackTrace();
- return null;
- }
- }
- @Override
- protected void onPostExecute(List<Address> result) {
- locationChanged(result);
- }
- }
- @Override
- public void onLocationChanged(Location loc) {
- mylat = loc.getLatitude();
- mylong = loc.getLongitude();
- new LocTask().execute(mylat, mylong);
- }
- public void locationChanged(List<Address> addresses) {
- // do stuff (if addresses != null)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement