Android Question Flexi Table Error

jahswant

Well-Known Member
Licensed User
Longtime User
I've been using flexi-table as for a long time now and now i want to implement it as custom view but i have great difficulties.Non of the events are raised even if signature is correct.And more of all i get an ArrayIndexOutOfBounds when i click on header for sorting.

B4X:
** Activity (databaseimport) Resume **
Error occurred on line: 1386 (Table)
java.lang.ArrayIndexOutOfBoundsException: length=0; index=1
    at cm.minesup.ehnen_project.table._header_click(table.java:2525)
    at java.lang.reflect.Method.invoke(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:372)
    at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:708)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:340)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:247)
    at java.lang.reflect.Method.invoke(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:372)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:134)
    at anywheresoftware.b4a.BA.raiseEvent(BA.java:153)
    at anywheresoftware.b4a.objects.ViewWrapper$1.onClick(ViewWrapper.java:78)
    at android.view.View.performClick(View.java:4825)
    at android.view.View$PerformClick.run(View.java:20225)
    at android.os.Handler.handleCallback(Handler.java:739)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:135)
    at android.app.ActivityThread.main(ActivityThread.java:5412)
    at java.lang.reflect.Method.invoke(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:372)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
** Service (starter) Destroy **
** Activity (databaseimport) Pause, UserClosed = true **


My Code is here

B4X:
dlgFileExpl.Initialize(Activity, "/mnt/sdcard", ".csv", True, False, "OK")
    dlgFileExpl.DialogRect.Left = 25dip
    dlgFileExpl.DialogRect.Right = 100%x - 25dip
    dlgFileExpl.DialogRect.Top = PnlContent.Top
    dlgFileExpl.DialogRect.Bottom = 95%y
    dlgFileExpl.BackgroundColor = Colors.LightGray
    dlgFileExpl.BorderColor = Colors.RGB(128, 128, 128)
    dlgFileExpl.FastScrollEnabled = True
    dlgFileExpl.FolderTextColor = Colors.Black
    dlgFileExpl.FileTextColor1 = Colors.Blue
    dlgFileExpl.FileTextColor2 = Colors.White
    dlgFileExpl.DividerColor = Colors.Gray
    dlgFileExpl.Explorer
    If Not(dlgFileExpl.Selection.Canceled Or dlgFileExpl.Selection.ChosenFile = "") Then
        Msgbox("File:" & CRLF & dlgFileExpl.Selection.ChosenPath & "/" & dlgFileExpl.Selection.ChosenFile, "Your choice")   
        Table1.Visible = True
        imgCSV.SendToBack
        imgCSV.Visible = False
        btnCancel.Visible = True
        btnImport.Visible = True
        Table1.LoadTableFromCSV(dlgFileExpl.Selection.ChosenPath , dlgFileExpl.Selection.ChosenFile,True)
    End If
 

klaus

Expert
Licensed User
Longtime User
I see also the problem with the header click.
The CellClick events are working.
You could change the Table code in Header_Click.
This code:
B4X:
If cColumnDataType(col) = "TEXT" Then
    sortTable(col,dir <=0)
Else
    sortTableNum(col,dir <=0)
End If
By this code:
B4X:
If cColumnDataType.Length > 0 Then
    If cColumnDataType(col) = "TEXT" Then
        sortTable(col,dir <=0)
    Else
        sortTableNum(col,dir <=0)
    End If
Else
    sortTable(col,dir <=0)
End If

For the other events, do you have a small project showing the problem?
 
Upvote 0

jahswant

Well-Known Member
Licensed User
Longtime User
By this code:
B4X:
If cColumnDataType.Length > 0 Then
    If cColumnDataType(col) = "TEXT" Then
        sortTable(col,dir <=0)
    Else
        sortTableNum(col,dir <=0)
    End If
Else
    sortTable(col,dir <=0)
End If

This code works well thank you.

For the other events, do you have a small project showing the problem?

No more need.All events are raised correctly.Please update the code of the custom view to generate exact events and their signatures.For now events need to complete their signatures.
 
Upvote 0
Top