Hello I ask again for some help with GPS map tracking.
My app log all the GPS points like this (.txt)
When I want to trace all the point I use this:
The SaveStringExample check if the file already exist, and if it exist I try to parse this file to get the position.
I have an error with the parsing : " pl.Points = File.ReadList(shared, "PositionsGPScycling.txt")"
This is the error:
How can I resolve this issue ? And it's enough to recreate my journey ?
Thanks =)
My app log all the GPS points like this (.txt)
When I want to trace all the point I use this:
B4X:
If gmap.IsInitialized Then
If File.ExternalWritable = False Then
Msgbox("No rights to write"," ")
Return
Else
shared = Starter.rp.GetSafeDirDefaultExternal("GPS_Location")
Starter.rp.CheckAndRequest(Starter.rp.PERMISSION_READ_EXTERNAL_STORAGE)
Starter.rp.CheckAndRequest(Starter.rp.PERMISSION_WRITE_EXTERNAL_STORAGE)
Wait For Activity_PermissionResult(Permission As String, Result As Boolean)
If Result Then SaveStringExample
End If
Dim pl As Polyline = gmap.AddPolyline
pl.Points = File.ReadList(shared, "PositionsGPScycling.txt")
pl.Color=Colors.Blue
pl.ZIndex=3
Else
Log("Gmap not initialize llll")
End If
I have an error with the parsing : " pl.Points = File.ReadList(shared, "PositionsGPScycling.txt")"
This is the error:
B4X:
Map is not ready yet.
** Activity (page_statistique) Resume **
Map is not ready yet.
Isinit=> true
Gmap isinit:> true
File exist
Error occurred on line: 242 (page_statistique)
java.lang.ClassCastException: java.lang.String cannot be cast to com.google.android.gms.maps.model.LatLng
at anywheresoftware.b4a.objects.MapFragmentWrapper$PolylineWrapper.setPoints(MapFragmentWrapper.java:496)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:710)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:339)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:249)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:139)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:166)
at anywheresoftware.b4a.shell.DebugResumableSub$RemoteResumableSub.resume(DebugResumableSub.java:19)
at anywheresoftware.b4a.BA.checkAndRunWaitForEvent(BA.java:240)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:132)
at anywheresoftware.b4a.BA$2.run(BA.java:360)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6121)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:889)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:779)
How can I resolve this issue ? And it's enough to recreate my journey ?
Thanks =)