Hello.
I have a problem.
The next iteration of the MapFragment _Ready procedure is getting slower,
until a Stack Overflow error occurs or another device out of memory. (9-10 iteration). Am I doing something wrong? In the actual program, the data for the map I download from the excel sheet. (Approximately 2000 points maximum). In the sample is 10000 to highlight the problem. I was trying to optimize the program.
The gmap.clear statement does not work, it looks like MapFragment did not release memory.
Regards
I have a problem.
The next iteration of the MapFragment _Ready procedure is getting slower,
until a Stack Overflow error occurs or another device out of memory. (9-10 iteration). Am I doing something wrong? In the actual program, the data for the map I download from the excel sheet. (Approximately 2000 points maximum). In the sample is 10000 to highlight the problem. I was trying to optimize the program.
The gmap.clear statement does not work, it looks like MapFragment did not release memory.
B4X:
#Region Project Attributes
#ApplicationLabel: B4A Example
#VersionCode: 1
#VersionName:
'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: unspecified
#CanInstallToExternalStorage: False
#AdditionalJar: com.google.android.gms:play-services-maps
#End Region
#Region Activity Attributes
#FullScreen: False
#IncludeTitle: True
#End Region
'Activity module
Sub Process_Globals
Dim czas_old As Long
Dim czas As Long
End Sub
Sub Globals
Private gmap As GoogleMap
Private MapFragment1 As MapFragment
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("2")
If MapFragment1.IsGooglePlayServicesAvailable = False Then
ToastMessageShow("Please install Google Play Services.", True)
End If
End Sub
Sub MapFragment1_Ready
gmap = MapFragment1.GetMap
czas_old = DateTime.Now
For i=0 To 10000
gmap.AddMarker(Rnd(30,45),Rnd(30,45),("marker"&i))
Next
czas=DateTime.Now-czas_old
Log (czas)
End Sub
Sub RETURN_Click
Activity.RemoveAllViews
Activity.LoadLayout("2")
End Sub
Sub START_Click
Activity.RemoveAllViews
Activity.LoadLayout("1")
End Sub
Regards