..
badge = badge + 1
UpdateIcon("cart", AddBadgeToIcon(cartBitmap, badge))
....
Sub AddBadgeToIcon(bmp As Bitmap, Number As Int) As Bitmap
Dim cvs As Canvas
Dim mbmp As Bitmap
mbmp.InitializeMutable(32dip, 32dip)
cvs.Initialize2(mbmp)
Dim target As Rect
target.Initialize(0, 0, mbmp.Width, mbmp.Height)
cvs.DrawBitmap(bmp, Null, target)
If Number > 0 Then
cvs.DrawCircle(mbmp.Width - 8dip, 8dip, 8dip, Colors.Red, True, 0)
cvs.DrawText(Min(Number, 9), mbmp.Width - 8dip, 12dip, Typeface.DEFAULT_BOLD, 12, Colors.White, "CENTER")
End If
Return mbmp
End Sub
Sub UpdateIcon(MenuTitle As String, Icon As Bitmap)
Dim m As ACMenuItem = GetMenuItem(MenuTitle)
m.Icon = BitmapToBitmapDrawable(Icon)
End Sub
Sub BitmapToBitmapDrawable (bitmap As Bitmap) As BitmapDrawable
Dim bd As BitmapDrawable
bd.Initialize(bitmap)
Return bd
End Sub