iOS Question Google maps marker modification

rboeck

Well-Known Member
Licensed User
Longtime User
In B4A i was able to change a bitmap and add a number, before i used this bitmap for a marker.

In B4I i tried this code:
B4X:
Dim Bitm As B4XBitmap = LoadBitmap(File.DirAssets,"Markerg.png")
    Cv.Initialize(Bitm)
    Cv.DrawCircle(25dip,39dip,14dip,Colors.DarkGray,True,0)
    Dim f As Font=Font.CreateNewBold(14)
    Cv.DrawText("1",25dip, 45dip, f,Colors.Yellow,"CENTER")
    m1= gmap.AddMarker3(48.54, 16.132, "Marker Nr.1", Bitm)

but i got this error: Expected: UIView, object type: UIImage
So my question: is it possible and which type of object has to be used?
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
You are not using Canvas correctly.

Code to create a B4XCanvas:
B4X:
Public Sub CreateCanvas (width1 As Int, height1 As Int) As B4XCanvas
   Dim iv As ImageView
   iv.Initialize("")
   iv.SetLayoutAnimated(0, 1, 0, 0, width1, height1)
   Dim c As B4XCanvas
   c.Initialize(iv)
   Return c
End Sub
You should then draw the bitmap, draw the other stuff, call Cv.Invalidate and get the bitmap with Cv.CreateBitmap.
Then release the canvas with Cv.Release (unless you want to keep it and use it again).
 
Upvote 0
Top