Code example for Location

Methods: getLatitudegetLongitudegetProvider

0
     
    class DemoLocationListener implements LocationListener {
 
		@Override 
		public void onLocationChanged(Location location) {
			if (location.getProvider() == LocationManager.GPS_PROVIDER) {
				 
			} 
			StringBuffer locationInfo = new StringBuffer();
			locationInfo.append("Lat : " + new DecimalFormat("#.#####").format(location.getLatitude()) + "\n");
			locationInfo.append("Lon: "  + new DecimalFormat("#.#####").format(location.getLongitude()) + "\n");
			 
			info.setText(locationInfo.toString());
			 
		} 
 
		@Override 
		public void onProviderDisabled(String provider) {			
		}