java.lang.IndexOutOfBoundsException: index=7 count=0

CharlesIPTI

Active Member
Licensed User
Longtime User
java.lang.IndexOutOfBoundsException: index=7 count=0

What is this error really telling me..

I have the exact same code running in a test project with no errors

B4X:
   ac1.Initialize("XC")
   ac2.Initialize("XC", ac2.VERTICAL)
   For i = 1 To 7
      Dim ai As AHActionItem
      Dim bd As BitmapDrawable
      Dim Filename, Text As String

      Select i
         Case 1         
            Filename = "menu_up_arrow.png"
            Text = "Prev"
         Case 2
            Filename = "menu_down_arrow.png"
            Text = "Next"
         Case 3
            Filename = "menu_info.png"
            Text = "Info"
         Case 4
            Filename = "menu_eraser.png"
            Text = "Delete"
         Case 5
            Filename = "menu_search.png"
            Text = "Search"
         Case 6
            Filename = "menu_cancel.png"
            Text = "Cancel"
         Case 7
            Filename = "menu_ok.png"
            Text = "Ok"
      End Select
      
      'Initialize a bitmap drawable and the action item
      bd.Initialize(LoadBitmap(File.DirAssets, Filename))
      ai.Initialize(i, Text, bd)
      ai.Selected = True
      
      'Make the Prev and Next items sticky so they will not close the popup
      If i = 1 OR i = 2 Then ai.Sticky = True
      
      'Add the item to both Quickactions popups
      ac1.addActionItem(ai)
      ac2.addActionItem(ai)
   Next
 

CharlesIPTI

Active Member
Licensed User
Longtime User
Of course

I Always do run in debug like every five minutes
the line is ac2.addActionItem(ai)



and your right but I cant see HOW its reaching this section of code

multiple times ...

the flags line 326 bBeginUiCreation = True
and line 388 = bAllowEntry = True

should be preventing any code from executing at line 524
If bAllowEntry = True Then

ac1.Initialize("XC")
ac2.Initialize("XC", ac2.VERTICAL) but they are being set somehow that I cant find while in debug...
 
Last edited:
Upvote 0
Top