B4J Question [SOLVED]Error using Sub B4XTableM_CellClicked ()

Mikelgiles

Active Member
Licensed User
Longtime User
I copied code from one of the example programs ('editable B4XTable' I think) and made some changes.
Here is my code that is getting the error and I have not been able to figure out what I have done wrong. Most of the changes were just changing B4XTable1 to B4XTableM. I have attached the log file and I can furnish the full source and test data if it is needed. The error doesnt show up on the screen like most do and just stops the execution of the app but does show it as '
Error occurred on line: 118 - java.lang.NullPointerException in the log file

B4X:
Sub B4XTableM_CellClicked (ColumnId As String, RowId As Long)
    Dim column As B4XTableColumn = B4XTableM.GetColumn(ColumnId)
    Dim value As String = B4XTableM.GetRow(RowId).Get(ColumnId)
    InputTemplate.Text = value
    InputTemplate.lblTitle.Text = column.Id   'line 118 error   column.Id = 'description'      InputTemplate is all null's except for Text which is = 'AT&T'
    Wait For (Dialog.ShowTemplate(InputTemplate, "OK", "", "CANCEL")) Complete (Result As Int)
    If Result = xui.DialogResponse_Positive Then
        B4XTableM.sql1.ExecNonQuery2($"UPDATE data SET ${column.SQLID} = ? WHERE rowid = ?"$, Array As String(InputTemplate.Text, RowId))
        B4XTableM.Refresh
    End If
End Sub
 

Attachments

  • LogFtle.txt
    30 KB · Views: 136
Last edited:

Mikelgiles

Active Member
Licensed User
Longtime User
Possibly the problem is here ... InputTemplate.lblTitle.Text = column.Id

Try ... InputTemplate.lblTitle.Text = ColumnId ... ( without "." In ColumnId)


Using ColumnId instead of Column.Id does not solve my problem. I am using a 64bit windows 8.1 machine and I always wonder if Microsoft has figured out another way to screw up my day LOL.

I have stripped the source down to where it is pretty small and only shows the problem that I can send if that helps. However I have not figured out how to handle the csv file needed for testing. I had attempted to include it with the source code using the 'Export to zip file' but I have not figured how to access from there in the source code. I never seem to be as smart as I thought I was! What is the proper process to include a data file?
 
Upvote 0

Mikelgiles

Active Member
Licensed User
Longtime User
Are you sure that InputTemplate was initialized? Can you upload the project?

Thank you Erel! I was sure it was initialized until you asked and I found out that it wasn't. Sometimes it is the simple things that produces that dumb feeling!
 
Upvote 0
Top