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:
Code: Copy
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?
 
You are not using Canvas correctly.

Code to create a B4XCanvas:
Code: Copy
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

Similar Threads

Replies
13
Views
6K
  • Article Article
Android Code Snippet [B4X] Custom GoogleMaps
Replies
13
Views
10K
  • Locked
  • Article Article
Replies
39
Views
31K
Back
Top