Displaying Speed

This commit is contained in:
TiclemFR
2024-06-26 20:31:14 +02:00
parent 0146559c72
commit da5709d5e8
3 changed files with 26 additions and 1 deletions

View File

@@ -9,7 +9,7 @@ android {
defaultConfig {
applicationId = "com.example.busroute"
minSdk = 24
minSdk = 26
targetSdk = 34
versionCode = 1
versionName = "1.0"

View File

@@ -72,6 +72,7 @@ class MainActivity : ComponentActivity() {
val marker = Marker(map)
marker.position = GeoPoint(latitude, longitude)
marker.title = "MARK BUTTON !!"
marker.textLabelFontSize = 10
marker.icon = ContextCompat.getDrawable(this, org.osmdroid.library.R.drawable.moreinfo_arrow)
map.overlays.add(marker)
map.invalidate()
@@ -115,6 +116,8 @@ class MainActivity : ComponentActivity() {
findViewById<TextView>(R.id.accuracy).text = "${location.accuracy} %"
findViewById<TextView>(R.id.position).text = "$latitude $longitude"
findViewById<TextView>(R.id.speed).text = "${location.speed} m/s"
findViewById<TextView>(R.id.speed_accuracy).text = "${location.speedAccuracyMetersPerSecond} %"
Log.i("Position", "$latitude $longitude")
Log.i("Accuracy Chosen", "${location.accuracy}")

View File

@@ -47,6 +47,28 @@
android:textColor="@color/black"
android:layout_height="wrap_content"
android:text=""/>
<TextView
android:layout_width="150dp"
android:layout_height="wrap_content"
android:textColor="@color/black"
android:text="Speed"/>
<TextView
android:id="@+id/speed"
android:layout_width="150dp"
android:textColor="@color/black"
android:layout_height="wrap_content"
android:text=""/>
<TextView
android:layout_width="150dp"
android:layout_height="wrap_content"
android:textColor="@color/black"
android:text="Speed Accuracy Meter Second"/>
<TextView
android:id="@+id/speed_accuracy"
android:layout_width="150dp"
android:textColor="@color/black"
android:layout_height="wrap_content"
android:text=""/>
</TableLayout>
<org.osmdroid.views.MapView