Android Question [Solved] How to put a Circle (Radius) on Map GoogleMapsExtra?

JoseTrujillo

New Member
Licensed User
Longtime User
Hi everyone:

My Name is José Trujillo, i'm from Chile...

i have a problem, and i can't solved it, i try to put a circle on "any location for now", with the next code:

'Dim CircleRadio As Circle
Dim MapRadio As CircleOptions
MapRadio.Initialize
MapRadio.Center(vPosicionGPS_ToMQTT)
MapRadio.Radius(1000)
MapRadio.FillColor(0xFFEF9A9A)
'MapRadio.StrokeColor(0xFFE57373)
MapRadio.StrokeColor(0xFFEF5350)
MapRadio.StrokeWidth(10dip)
MapRadio.Visible(True)
GMapsExtra.AddCircle(gmap, MapRadio)

- Object called "gmap" is an instance of Lib GoogleMap (I Can see, move, zoom, pinch in, pinch out, renderize and work with the map and full properties and events correctly)

- This lines are in the end of the event "MapFragment_Ready" after my own code.

- The error on Compile is the next:

B4A version: 5.02 (1)
Parsing code. (0.06s)
Running custom action. (0.05s)
Compiling code. (0.17s)
Compiling layouts code. (0.03s)
Generating R file. (0.67s)
Compiling generated Java code. Error
B4A line: 1429
GMapsExtra.AddCircle(gmap, MapRadio)
javac 1.8.0_45
src\b4a\example\testgps\main.java:2106: error: cannot find symbol
mostCurrent._gmapsextra.AddCircle((com.google.android.gms.maps.GoogleMap)(mostCurrent._gmap.getObject()),(com.google.android.gms.maps.model.CircleOptions)(_mapradio.getObject()));

^
symbol: class CircleOptions
location: package com.google.android.gms.maps.model


- Someone know why this happens? i search in all this forum about any tutorial of GoogleMapsExtras and there is no example for implement this.

thank you very much!!!
 
Please use [code]code here...[/code] tags when posting code.

upload_2016-9-15_8-24-23.png


Code:
Code: Copy
#Region  Project Attributes
   #ApplicationLabel: B4A Example
   #VersionCode: 1
   #VersionName:
   #SupportedOrientations: unspecified
   #CanInstallToExternalStorage: False
   #AdditionalJar: com.google.android.gms:play-services-maps
#End Region

#Region  Activity Attributes
   #FullScreen: False
   #IncludeTitle: True
#End Region

Sub Process_Globals
   Private rp As RuntimePermissions
End Sub

Sub Globals
   Private gmapExtra As GoogleMapsExtras
   Private gmap As GoogleMap
   Private MapFragment1 As MapFragment
End Sub

Sub Activity_Create(FirstTime As Boolean)
   Activity.LoadLayout("1")
End Sub

Sub MapFragment1_Ready
   gmap = MapFragment1.GetMap
   rp.CheckAndRequest(rp.PERMISSION_ACCESS_FINE_LOCATION)
   Dim co As CircleOptions
   co.Initialize
   co.Center2(40, 20).Radius(500000).FillColor(Colors.Red).StrokeColor(Colors.Yellow)
   gmapExtra.AddCircle(gmap, co)
End Sub

Sub Activity_PermissionResult (Permission As String, Result As Boolean)
   If Permission = rp.PERMISSION_ACCESS_FINE_LOCATION Then
     gmap.MyLocationEnabled = Result
   End If
End Sub

It is based on this tutorial: https://www.b4x.com/android/forum/threads/google-maps.63930/
 
Upvote 0
Please use
Code: Copy
code here...
tags when posting code.

upload_2016-9-15_8-24-23-png.47837


Code:
Code: Copy
#Region  Project Attributes
   #ApplicationLabel: B4A Example
   #VersionCode: 1
   #VersionName:
   #SupportedOrientations: unspecified
   #CanInstallToExternalStorage: False
   #AdditionalJar: com.google.android.gms:play-services-maps
#End Region

#Region  Activity Attributes
   #FullScreen: False
   #IncludeTitle: True
#End Region

Sub Process_Globals
   Private rp As RuntimePermissions
End Sub

Sub Globals
   Private gmapExtra As GoogleMapsExtras
   Private gmap As GoogleMap
   Private MapFragment1 As MapFragment
End Sub

Sub Activity_Create(FirstTime As Boolean)
   Activity.LoadLayout("1")
End Sub

Sub MapFragment1_Ready
   gmap = MapFragment1.GetMap
   rp.CheckAndRequest(rp.PERMISSION_ACCESS_FINE_LOCATION)
   Dim co As CircleOptions
   co.Initialize
   co.Center2(40, 20).Radius(500000).FillColor(Colors.Red).StrokeColor(Colors.Yellow)
   gmapExtra.AddCircle(gmap, co)
End Sub

Sub Activity_PermissionResult (Permission As String, Result As Boolean)
   If Permission = rp.PERMISSION_ACCESS_FINE_LOCATION Then
     gmap.MyLocationEnabled = Result
   End If
End Sub
It is based on this tutorial: https://www.b4x.com/android/forum/threads/google-maps.63930/

Erel, Thanks! but my problem it was not that, my problem was the Version of Library "jar" of GoogleMaps, an his "resources folder"

The Version with the problem is:

'GOOGLE MAPS - v2.0.12
'#AdditionalJar: google-play-services_OLD
'#AdditionalRes: "E:/B4AResources/google_play_services/libproject/google-play-services_lib/res", com.google.android.gms
'#AdditionalRes: ../resources/google_play_services/libproject/google-play-services_lib/res", com.google.android.gms

i Updated to a new version on my project, the next:

'GOOGLE MAPS - v6.5.87
#AdditionalJar: google-play-services
#AdditionalRes: ../resources/google_play_services_new/res, com.google.android.gms

This version i found in this folder on my Android SDK, into the next file "play-services-6.5.87.aar":

- android-sdk\extras\google\m2repository\com\google\android\gms\play-services\6.5.87\play-services-6.5.87.aar

this file i opened with WinRar (or similar) and extract it on my project resource folder, now, the map renderization it has been updated with new interface and look & feel, the renderization is faster and High Quality!!!

very good and thank you very much, becouse i try your code and not work for my. this give me the begin for solve and update the quality of the Application

thanks!

PD: Sorry for my english if something is wrong
 
Last edited:
Upvote 0
Back
Top