Android Question B4XTable Load - Strange Behavior

Ronald Berardinis

Member
Licensed User
When loading the table, the log shows the create process occurs twice?
The TableView_DataUpdated to better size column is three times?

** Activity (actwarehousetowarehouse) Pause event (activity is not paused). **
** Activity (actpopuplist) Create, isFirst = true **
Activity Create true
Load frmPopUpList
No Of Columns = 3 Width = 0
Load_List
No of Rows = 21
** Activity (actpopuplist) Resume **
TableView_DataUpdated
Activity Create true
Load frmPopUpList
No Of Columns = 3 Width = 0
Load_List
No of Rows = 21
TableView_DataUpdated
(NullPointerException) java.lang.NullPointerException: Attempt to invoke virtual method 'anywheresoftware.b4a.objects.B4XViewWrapper$B4XFont anywheresoftware.b4a.objects.B4XViewWrapper.getFont()' on a null object reference
TableView_DataUpdated
TableView_DataUpdated

what is wrong with the code to see this happen twice.

thank you in advance
Ron
 

Brian Dean

Well-Known Member
Licensed User
Longtime User
When loading the table, the log shows the create process occurs twice?
No - I don't think that that is true. The line "** Activity (actpopuplist) Create ..." occurs only once, followed, as one would expect, by "** Activity (actpopuplist) Resume".

Whatever piece of code that prints the log message "Activity Create true" is running twice, but the second time is after Activity Create has finished. That is presumably due to an error in your code, but without having any code to look at it is hard to say more.
 
Upvote 0

Brian Dean

Well-Known Member
Licensed User
Longtime User
I have had a brief look at your code - it is quite unconventional and I am not surprised that you are having trouble. I mention some of the things that I think are causing problems below. I guess that you must have written code in this style before but I never have, so I probably cannot help you much.

Here are some of the things that I find unusual and likely to cause trouble ...

1. You have executable code in Sub Globals. This is not normal (it is intended only for declarations) and may well be causing effects that you do not expect.

2. In Sub Activity_Create you have this code :
B4X:
If FirstTime = False Then
            Return
        End If

I don't know what you are trying to achieve, but I suspect that what is happening is not what you think is happening.

3. In Activity_Create you have references to what I assume is a class (GlobalFunctions) in the following form ...
B4X:
If GlobalFunctions.aryMasterList.IsInitialized = False Then
            GlobalFunctions.Popup_Query_Message = "Nothing to show."
            Activity.Finish
            Return
        End If
Again, trying to close an Activity before Activity_Create has finished is something that I have never attempted but I would expect to lead to problems. Also, putting "Return" after "Activity.Finish" does not make sense.

4. Sub Activity_Resume is entirely missing from this code.

The best suggestion I can make is that you look at some coding examples and tutorials and try to follow a more standard code structure. Also if you want anybody else to give advice then post your complete project ("Export as Zip"). It might be a good time to start using B4XPages.
 
Upvote 0

Ronald Berardinis

Member
Licensed User
I have had a brief look at your code - it is quite unconventional and I am not surprised that you are having trouble. I mention some of the things that I think are causing problems below. I guess that you must have written code in this style before but I never have, so I probably cannot help you much.

Here are some of the things that I find unusual and likely to cause trouble ...

1. You have executable code in Sub Globals. This is not normal (it is intended only for declarations) and may well be causing effects that you do not expect.

2. In Sub Activity_Create you have this code :
B4X:
If FirstTime = False Then
            Return
        End If

I don't know what you are trying to achieve, but I suspect that what is happening is not what you think is happening.

3. In Activity_Create you have references to what I assume is a class (GlobalFunctions) in the following form ...
B4X:
If GlobalFunctions.aryMasterList.IsInitialized = False Then
            GlobalFunctions.Popup_Query_Message = "Nothing to show."
            Activity.Finish
            Return
        End If
Again, trying to close an Activity before Activity_Create has finished is something that I have never attempted but I would expect to lead to problems. Also, putting "Return" after "Activity.Finish" does not make sense.

4. Sub Activity_Resume is entirely missing from this code.

The best suggestion I can make is that you look at some coding examples and tutorials and try to follow a more standard code structure. Also if you want anybody else to give advice then post your complete project ("Export as Zip"). It might be a good time to start using B4XPages.
ok. thank you for your suggestions. i will try.
 
Upvote 0
Top