Code example for Timer

Methods: cancel

0
        public void onStatusChanged(String provider, int status, Bundle extras) {} 
    }; 
 
    LocationListener locationListenerNetwork = new LocationListener() {
        public void onLocationChanged(Location location) { 
            timer1.cancel(); 
            lm.removeUpdates(this); 
            lm.removeUpdates(locationListenerGps); 
            locationResult.gotLocation(location); 
        } 
        public void onProviderDisabled(String provider) {} 
        public void onProviderEnabled(String provider) {} 
        public void onStatusChanged(String provider, int status, Bundle extras) {} 
    }; 
     
	public static String getGeoLocationString(Context context, double latitude, double longitude) {
		String addrStr = "";
 
		Geocoder gc = new Geocoder(context, Locale.getDefault());
		try { 
			List<Address> addresses = gc.getFromLocation(latitude, longitude, 1);