Commit ec4104a7 authored by Victor Mocelin's avatar Victor Mocelin
Browse files

Merge branch 'develop' into 'develop'

Altitude adicionada

Adicionei uma *textview* para mostrar a **atitude** do ~~caboclo~~ usuário 😉

See merge request !1
parents eb54a43c 5ef74370
......@@ -39,6 +39,7 @@ public class MainActivity extends ActionBarActivity implements LocationListener
private LocationManager locationManager;
private TextView latitudeText;
private TextView longitudeText;
private TextView altitudeText;
private String provider;
@Override
......@@ -49,6 +50,7 @@ public class MainActivity extends ActionBarActivity implements LocationListener
//Pegamos a referência as TextViews que vamos modificar
latitudeText = (TextView) findViewById(R.id.latitude_label);
longitudeText = (TextView) findViewById(R.id.longitude_label);
altitudeText = (TextView) findViewById(R.id.altitude_label);
//Construímos o locationManager e pegamos o serviço em execução
locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
......@@ -69,6 +71,7 @@ public class MainActivity extends ActionBarActivity implements LocationListener
}else{
latitudeText.setText(R.string.no_location_detected);
longitudeText.setText(R.string.no_location_detected);
altitudeText.setText(R.string.no_location_detected);
}
}
......@@ -112,8 +115,10 @@ public class MainActivity extends ActionBarActivity implements LocationListener
public void onLocationChanged(Location location) {
float lat = (float) (location.getLatitude());
float lng = (float) (location.getLongitude());
latitudeText.setText("Latitude:" + String.valueOf(lat));
longitudeText.setText("Longitude" + String.valueOf(lng));
float alt = (float) (location.getAltitude());
latitudeText.setText("Latitude: " + String.valueOf(lat));
longitudeText.setText("Longitude: " + String.valueOf(lng));
altitudeText.setText("Altitude: " + String.valueOf(alt));
}
@Override
......
......@@ -21,4 +21,13 @@
android:id="@+id/longitude_label"
android:layout_below="@+id/latitude_label"
android:layout_centerHorizontal="true" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Altitude:"
android:id="@+id/altitude_label"
android:layout_below="@+id/longitude_label"
android:layout_alignLeft="@+id/latitude_label"
android:layout_alignStart="@+id/latitude_label" />
</RelativeLayout>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment