B4J Question Cast Exception

micro

Well-Known Member
Licensed User
Longtime User
Hi
in a resumable sub i have this code
B4X:
Sub CloseWork(start as int)
      Dim row() as String
      Dim i as int
      For i = start To Main.TableView1.Items.Size - 1
            Main.TableView1.SelectedRow = i
            row =  Main.TableView1.SelectedRowValues
           'here the error is logged

Error: java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to [Ljava.lang.String;
Because row() are string and TableView Row are object

but I remember that in earlier versions of B4j did not happen (or do I remember well?)
In debug mode work fine only in release mode not work.
 

micro

Well-Known Member
Licensed User
Longtime User
Note that you don't need to change the selected row at all:
sure, I saw
I hade solved in this way

B4X:
Dim row() As Object
row = Main.TableView.Items.Get(i)
Dim s As String = row(0)
......

Thanks
 
Upvote 0
Top