Sub Globals
    Dim ULV As UltimateListView
    Dim Fruits As List
    Dim ItemHeight As Int = 60dip
    Dim i As Int
End Sub
Sub Activity_Create(FirstTime As Boolean)
    'Creates a list of fruits
    Fruits.Initialize2(Array As String("Apple", "Banana", "Cherry", "Coconut", "Grapes", "Lemon", "Mango", "Melon", "Orange", "Pear", "Pineapple", "Strawberry"))
    Activity.AddMenuItem("First", "First")
    'Adds an ULV to the activity
    ULV.Initialize(0, 0, "", "ULV")
    ULV.Color = Colors.White
    ULV.SelectionMode = ULV.SELECTION_SINGLE
    Activity.AddView(ULV, 0, 0, 100%x, 100%y)
    'Creates a layout to display the fruit name and builds the items list (1 item = 1 fruit)
    ULV.AddLayout("FRUIT_NAME", "Item_LayoutCreator", "Item_ContentFiller", ItemHeight, True)
    ULV.BulkAddItems(Fruits.Size, "FRUIT_NAME", 0)
  
    ULV.SetSelected(0, True)
End Sub
Sub First_Click
    i = i + 1
    ULV.JumpTo(i,True)
    ULV.SetSelected(i, True)
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause(UserClosed As Boolean)
End Sub
Sub Item_LayoutCreator(LayoutName As String, LayoutPanel As Panel)
    'Very simple layout: just a label
    LayoutPanel.LoadLayout("fruitlabel")
End Sub
Sub Item_ContentFiller(ItemID As Long, LayoutName As String, LayoutPanel As Panel, Position As Int)
    'Sets the text of the label
    If ULV.IsSelected(Position) Then
        'The selected rows are green
        LayoutPanel.Color = Colors.Green
    Else
        'Alternatively, the rows are coloured in white or in light gray
        If Position Mod 2 = 0 Then
            LayoutPanel.Color = Colors.White
        Else
            LayoutPanel.Color = Colors.LightGray
        End If
    End If
  
  
    Dim lbl As Label = LayoutPanel.GetView(0) 'First (and only) view in the panel
    lbl.Text = Fruits.Get(Position)
End Sub