Sub Globals
Dim rbar As View
End Sub
Sub Activity_Create(FirstTime As Boolean)
rbar = CreateRatingBar("rbar")
Activity.AddView(rbar, 10dip, 10dip, -2, 100dip) 'width must be set to -2 (WRAP_CONTENT)
End Sub
Sub CreateRatingBar (EventName As String) As Object
Dim context As Object = GetBA.GetField("context")
Dim jo As JavaObject
jo.InitializeNewInstance("android.widget.RatingBar", Array (context))
jo.RunMethod("setNumStars", Array(5))
Dim event As Object = jo.CreateEventFromUI("android.widget.RatingBar.OnRatingBarChangeListener", _
EventName, Null)
jo.RunMethod("setOnRatingBarChangeListener", Array(event))
Return jo
End Sub
Sub rbar_Event (MethodName As String, Args() As Object) As Object
Dim rating As Float = args(1)
Dim FromUser As Boolean = Args(2) 'ignore
Activity.Title = rating
Return Null
End Sub
Sub GetBA As JavaObject
Dim jo As JavaObject
Dim cls As String = Me
cls = cls.SubString("class ".Length)
jo.InitializeStatic(cls)
Return jo.GetFieldJO("processBA")
End Sub