Need a circular marker with a specified colour for an Osmdroid markeroverlay and thought I could do it like this:
But this gives the error: BitmapDrawable cannot be converted to Bitmap in the code in Sub Activity_Create.
Any idea how this could be done?
RBS
B4X:
Sub Globals()
Private bmpPatientMarker As BitmapDrawable
End Sub
Sub Activity_Create(FirstTime As Boolean)
bmpPatientMarker.Initialize(TextToBitmapDrawable("O", 24, Colors.RGB(255, 0, 0)))
End Sub
Sub TextToBitmapDrawable (s As String, FontSize As Float, lFontColour As Long) As BitmapDrawable
Dim bmp As Bitmap
Dim cvs As Canvas
Dim bmpD As BitmapDrawable
bmp.InitializeMutable(28dip, 24dip)
cvs.Initialize2(bmp)
Dim h As Double = cvs.MeasureStringHeight(s, lblID.Typeface, FontSize)
cvs.DrawText(s, bmp.Width / 2, bmp.Height / 2 + h / 2, lblID.Typeface, FontSize, lFontColour, "CENTER")
bmpD.Initialize(bmp)
Return bmpD
End Sub
But this gives the error: BitmapDrawable cannot be converted to Bitmap in the code in Sub Activity_Create.
Any idea how this could be done?
RBS