Hi,
In my Activity I have 2 views
Spinner and TableView
I have used designer to create the views
My requirement:-
The user uses the Spinner to select a Table Name and the TableView will display the contents from the selected table by the user.
Problem:-
Table No 1 contains 6 columns
Table No 2 contains 3 columns
If the user selects the table no 2 first and then the second table then it errors out. I guess that the reason is the columns in Table 2 is lesser than the Table 1
If the user selects the Table No 1 first (which has more number of columns) and then the Table no 2, it works fine ie no errors.
What would be the right way to get this done. Should I keep 2 different TableViews ie one for each. ?
The run time error that I get is given below
** Activity (viewmasters) Resume **
table_innerclearall (java line: 1342)
java.lang.ArrayIndexOutOfBoundsException: length=3; index=3
at com.mycompany.myappname.table._innerclearall(table.java:1342)
at com.mycompany.myappname.table._loadsqlitedb(table.java:1565)
at com.mycompany.myappname.viewmasters._spnrmasters_itemclick(viewmasters.java:454)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:179)
at anywheresoftware.b4a.BA$1.run(BA.java:303)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:158)
at android.app.ActivityThread.main(ActivityThread.java:7229)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
Any help will be appreciated.
EDIT:- I noticed that this issue occurs only if I use TblView.SetCellAlignments
In my Activity I have 2 views
Spinner and TableView
I have used designer to create the views
My requirement:-
The user uses the Spinner to select a Table Name and the TableView will display the contents from the selected table by the user.
Problem:-
Table No 1 contains 6 columns
Table No 2 contains 3 columns
If the user selects the table no 2 first and then the second table then it errors out. I guess that the reason is the columns in Table 2 is lesser than the Table 1
If the user selects the Table No 1 first (which has more number of columns) and then the Table no 2, it works fine ie no errors.
What would be the right way to get this done. Should I keep 2 different TableViews ie one for each. ?
The run time error that I get is given below
** Activity (viewmasters) Resume **
table_innerclearall (java line: 1342)
java.lang.ArrayIndexOutOfBoundsException: length=3; index=3
at com.mycompany.myappname.table._innerclearall(table.java:1342)
at com.mycompany.myappname.table._loadsqlitedb(table.java:1565)
at com.mycompany.myappname.viewmasters._spnrmasters_itemclick(viewmasters.java:454)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:179)
at anywheresoftware.b4a.BA$1.run(BA.java:303)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:158)
at android.app.ActivityThread.main(ActivityThread.java:7229)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
B4X:
TblView.ClearAll
TblView.LoadSQLiteDB(Starter.SQL1, cSql, True)
TblView.SetCellAlignments(Alignments)
Any help will be appreciated.
EDIT:- I noticed that this issue occurs only if I use TblView.SetCellAlignments
Last edited: