Location hasAltitude - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Location hasAltitude method.

This code example shows how to use the following methods:hasAltitude
    public double getLongitude() { 
        return mLocation.getLongitude();
    } 
 
    public boolean hasAltitude() { 
        return mLocation.hasAltitude();
    } 
 
    public double getAltitude() { 
        return mLocation.getAltitude();
    } 
 
    public boolean hasBearing() { 
        return mLocation.hasBearing();
    } 
 
    public void setBearing(float bearing) {
        mLocation.setBearing(bearing);
    } 
 
7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getAltitude, hasAltitude
			return "Bearing not available"; 
		} 
	} 
	 
	private double getAltitude(Location location) {
		if (location != null && location.hasAltitude()) {
			return (double) location.getAltitude();
		} else { 
			return -1.0; 
		} 
	} 
	 
	private String getAltitudeString(Location location) {
		if (location != null && location.hasAltitude()) {
			double altitude = location.getAltitude();
			return "Altitude: " + altitude + " m";
		} else { 
			return "Altitude not available"; 
		} 
	} 
7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:hasAccuracy, hasAltitude, hasBearing, hasSpeed
    public void logWithoutUpdate() { 
        makeEntry(); 
    } 
 
    public void logAdvancedFeatureStatus(Location location) {
        Log.i(_tag, "Accuracy  : " + location.hasAccuracy());
        Log.i(_tag, "Altitude  : " + location.hasAltitude());
        Log.i(_tag, "Bearing   : " + location.hasBearing());
        Log.i(_tag, "Speed     : " + location.hasSpeed());
 
    } 
 
    protected void makeEntry() { 
        Log.i(_tag, "Provider  : " + _location.getProvider());
        Log.i(_tag, "Latitude  : " + _location.getLatitude());
        Log.i(_tag, "Longitude : " + _location.getLongitude());
        Log.i(_tag, "Accuracy  : " + _location.getAccuracy());
        Log.i(_tag, "Altitude  : " + _location.getAltitude());
        Log.i(_tag, "Bearing   : " + _location.getBearing());
        Log.i(_tag, "Speed     : " + _location.getSpeed());
8
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getAccuracy, getBearing, getLatitude, getLongitude, getSpeed
     * @param location Location to insert 
     * @return the row ID of the newly inserted row, or -1 if an error occurred (see android.database.sqlite.SQLiteDatabase.insert(...)) 
     */ 
    public long insertLocation(Location location) {
    	ContentValues values = new ContentValues(7);
    	values.put(KEY_TIME, location.getTime());
    	values.put(KEY_LAT, location.getLatitude());
    	values.put(KEY_LONG, location.getLongitude());
    	values.put(KEY_ALT, location.hasAltitude());
    	values.put(KEY_ACCURACY, location.getAccuracy());
    	values.put(KEY_SPEED, location.getSpeed());
    	values.put(KEY_BEARING, location.getBearing());
    	 
    	return mDb.insert(TABLE_COORD, null, values);
    } 
    
} 
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:distanceTo, getAccuracy, getAltitude, hasAccuracy, hasAltitude
	public void onProviderDisabled(String provider) {
	} 
 
	public void getGPSData() { 
		if (actualLocation != null) {
			if (actualLocation.hasAltitude()) {
				altitude = (String.valueOf(actualLocation.getAltitude()));
			} else { 
				altitude = " - ";
			} 
			if (actualLocation.hasAccuracy()) {
				accuracy = String.valueOf(round(actualLocation.getAccuracy()));
			} else { 
				accuracy = " - ";
			} 
		} 
	} 
 
	private static float round(float toRound) {
		return Math.round(toRound * 100f) / 100f;
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getAltitude, getLatitude, getLongitude, hasAltitude
   * @param location the location 
   * @param builder the string builder 
   */ 
  @VisibleForTesting 
  static void appendLocation(Location location, StringBuilder builder) {
    builder.append(location.getLongitude()).append(",").append(location.getLatitude());
    if (location.hasAltitude()) {
      builder.append(",");
      builder.append(location.getAltitude());
    } 
  } 
 
  /** 
   * Gets the table id from an input streawm. 
   * 
   * @param inputStream input stream 
   * @return table id or null if not available. 
   */ 
  public static String getTableId(InputStream inputStream) {
    if (inputStream == null) {
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getAltitude, getLatitude, getLongitude, hasAltitude
	public static String convertLocation(Mark mark){
		return convertLocation(mark.getLatitude(), mark.getLongitude(), 0.0);
	} 
	 
	public static String convertLocation(Location loc){
		double alt = loc.hasAltitude() ? loc.getAltitude() : 0.0;
		return convertLocation(loc.getLatitude(), loc.getLongitude(), alt);
	} 
	 
	public static String convertLocation(double lat, double lon, double alt){
		StringBuffer strBuffer = new StringBuffer();
		strBuffer.append("lat: ").append(String.valueOf(lat)).
			append("  lon: ").append(String.valueOf(lon));
			// append("  alt: ").append(String.valueOf(alt)); 
		return strBuffer.toString();
	} 
 
} 
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getAccuracy, getAltitude, getBearing, getExtras, getLatitude
                                  boolean hasSpeed, double speed,
                                  boolean hasAccuracy, double accuracy,
                                  boolean hasAcceleration, double acceleration);
 
  private void sendLocation(Location location) {
    Bundle extras = location.getExtras();
 
    setLocation(location.getTime(),
                extras != null ? extras.getInt("satellites", -1) : -1,
                location.getLongitude(), location.getLatitude(),
                location.hasAltitude(), location.getAltitude(),
                location.hasBearing(), location.getBearing(),
                location.hasSpeed(), location.getSpeed(),
                location.hasAccuracy(), location.getAccuracy(),
                true, acceleration);
  } 
 
  private void setConnectedSafe(int connected) {
    if (!safeDestruct.Increment())
      return; 

7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getAltitude, getLatitude, getLongitude, hasAltitude
	private void fireIfFinished() { 
		if (!hasBearing || !hasLocation || !hasTemperature) {
			return; 
		} 
		 
		listener.onLocation(bestLocation.getLatitude(), bestLocation.getLongitude(), 
				bestLocation.hasAltitude() ?
						bestLocation.getAltitude() : null, bearing, temperature);
		reset(); 
	} 
	 
	// Unused 
	 
	@Override public void onProviderEnabled(String provider) { }
	@Override public void onProviderDisabled(String provider) { }
} 
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getAltitude, getBearing, getLatitude, getLongitude, getProvider
    { 
 
        StringBuilder waypoint = new StringBuilder();
 
        waypoint.append("\n<wpt lat=\"")
                .append(String.valueOf(loc.getLatitude()))
                .append("\" lon=\"")
                .append(String.valueOf(loc.getLongitude()))
                .append("\">");
 
        if (loc.hasAltitude())
        { 
            waypoint.append("<ele>").append(String.valueOf(loc.getAltitude())).append("</ele>");
        } 
 
        if (loc.hasBearing())
        { 
            waypoint.append("<course>").append(String.valueOf(loc.getBearing())).append("</course>");
        } 
 

7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java

Related Location hasAltitude Questions & Answers:

hasAltitude Method Overview
True if this location has an altitude.
See Code Examples for other Android Location Methods: