Android Question Please help OnMyLocationButtonClickListener1

naifnas

Active Member
Licensed User
Thanks for all
Please help
i have problem when use this
B4X:
Dim OnMyLocationButtonClickListener1 As OnMyLocationButtonClickListener
        OnMyLocationButtonClickListener1.Initialize("OnMyLocationButtonClickListener1")
        GoogleMapsExtras1.SetOnMyLocationButtonClickListener(GoogleMap1,OnMyLocationButtonClickListener1)

    End If
End Sub

Sub OnMyLocationButtonClickListener1_Click
    Log("clicked")

End Sub

this error

B4A Version: 7.30
Parsing code. (0.00s)
Compiling code. (0.06s)
Compiling layouts code. (0.00s)
Organizing libraries. (0.00s)
Generating R file. (0.06s)
Compiling debugger engine code. (0.66s)
Compiling generated Java code. Error
B4A line: 88
GoogleMapsExtras1.SetOnMyLocationButtonClickList
javac 1.8.0_144
src\com\example\android\mapexample\main.java:512: error: cannot find symbol
_googlemapsextras1.SetOnMyLocationButtonClickListener((com.google.android.gms.maps.GoogleMap)(mostCurrent._googlemap1.getObject()),(com.google.android.gms.maps.GoogleMap.OnMyLocationButtonClickListener)(_onmylocationbuttonclicklistener1.getObject()));
^
symbol: class OnMyLocationButtonClickListener
location: class GoogleMap
1 error
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
Your code is wrong. You should let the IDE autocomplete the events.

Working code:
B4X:
Sub Globals
   Private gmap As GoogleMap
   Private MapFragment1 As MapFragment
   Private Panel1 As Panel
End Sub

Sub Activity_Create(FirstTime As Boolean)
   Activity.LoadLayout("1")
   Wait For MapFragment1_Ready
   gmap = MapFragment1.GetMap
   Dim GoogleMapsExtras1 As GoogleMapsExtras
   Dim OnMyLocationButtonClickListener1 As OnMyLocationButtonClickListener
   OnMyLocationButtonClickListener1.Initialize("OnMyLocationButtonClickListener1")
   GoogleMapsExtras1.SetOnMyLocationButtonClickListener(gmap, OnMyLocationButtonClickListener1)

End Sub

Sub OnMyLocationButtonClickListener1_MyLocationButtonClick As Boolean
   Log("click")
   Return True
End Sub

This is not related to the compilation error you got. I can only guess that you haven't updated the SDK correctly.
 
Upvote 0

naifnas

Active Member
Licensed User
thanks all now work
 

Attachments

  • a.png
    a.png
    439.6 KB · Views: 185
Upvote 0
Top