Code example for Location

Methods: setAltitudesetLatitudesetLongitude

0
		Location l1 = getLocation(lat1, lon1);
		Location l2 = getLocation(lat2, lon2);
		return l1.distanceTo(l2);
	} 
	public static Location getLocation(double lat, double lon) {
		Location l2 = new Location("gps");
		l2.setLatitude(lat);
		l2.setLongitude(lon);
		l2.setAltitude(0);
		return l2;
	} 
 
	public static synchronized void updateRequired(Context context, boolean req) {
		if (context==null) {
			Log.e(TAG,"updateRequired called with null context - ignored");
			return; 
		} 
		Log.d(TAG,"updateRequired("+req+")");
		if (locationCallback==null) {
			locationCallback = new LocationCallback(context);			
Experience pair programming with AI  Get Codota for Java