public void run()
{
while (updateLocality)
{
try
{
Location l = currentLocation; //
lm.getLastKnownLocation(LocationManager.GPS_PROVIDER);
Log.v(TAG, "gecoding current location "
+ "Lat: " +
Location.convert(l.getLatitude(),
Location.FORMAT_SECONDS)
+ " Lon: "
+ Location.convert(l.getLongitude(),
Location.FORMAT_SECONDS));
List<Address> list =
geocoder.getFromLocation(l.getLatitude(),
l.getLongitude(), 1);
Log.v(TAG, "geocoding list = " +
list.toString());
if (!list.isEmpty() ||
(list.get(0).getLocality() != null))
{
String locality =
list.get(0).getLocality();
if (locality.length() != 0)
{
TripLocality ta = new
TripLocality(list.get(0).getLocality(),
l);
locationsTravelled.add(ta);
}
}
handler.sendEmptyMessage(0);
Thread.sleep(120000);
}
catch (IOException e) {
Log.v(TAG, "Geocoder run() error: " +
e.toString());
try {
Thread.sleep(120000);
} catch (InterruptedException e1) {
// TODO Auto-generated catch block
Log.v(TAG, e1.toString());
}
}
catch (Exception e) {
Log.v(TAG, e.toString());
//
((TextView)findViewById(R.id.statusTV)).setText(e.toString());
}
}
}
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en