Hello,
Based on following :-
private Sub ReadData
Private My_Query As JdbcResultSet = MYSQL.ExecQuery("SELECT CityID FROM tblCity")
RowIDList.Clear
Do While My_Query.NextRow
RowIDList.Add(My_Query.GetInt2(0))
Loop
CurrentIndex = 0
My_Query.Close
End Sub
private Sub Show_Data(EntryIndex As Int)
Private MY_Query As JdbcResultSet
B4XTable1.AddColumn("City ID" , B4XTable1.COLUMN_TYPE_NUMBERS)
B4XTable1.AddColumn("City Name" , B4XTable1.COLUMN_TYPE_TEXT)
Dim Data As List
Data.Initialize
MY_Query = MYSQL.ExecQuery("SELECT * FROM tblCity")
Do While MY_Query.NextRow
Dim Rows(2) As Object
Rows(0) = MY_Query.GetInt2(0)
Rows(1) = MY_Query.GetString2(1)
Data.Add(Rows)
Loop
MY_Query.Close
B4XTable1.SetData(Data)
End Sub
private Sub B4XPage_Appear
conLinkServer
RowIDList.Initialize
End Sub
Private Sub brnLoadData_Click
ReadData
Show_Data(0)
End Sub
First when B4XPage Appear get Link to SQL Server,
Second when press Button need to read and Show Data on B4XTable,
that process work fine when run in Debug Mode, But when run in Release mode, I got Error on Reading Data as following:
"android.os.NetworkOnMainThreadException"
What Exactly the case to be take care between Debug and Release ?
many thanks in advance
Based on following :-
private Sub ReadData
Private My_Query As JdbcResultSet = MYSQL.ExecQuery("SELECT CityID FROM tblCity")
RowIDList.Clear
Do While My_Query.NextRow
RowIDList.Add(My_Query.GetInt2(0))
Loop
CurrentIndex = 0
My_Query.Close
End Sub
private Sub Show_Data(EntryIndex As Int)
Private MY_Query As JdbcResultSet
B4XTable1.AddColumn("City ID" , B4XTable1.COLUMN_TYPE_NUMBERS)
B4XTable1.AddColumn("City Name" , B4XTable1.COLUMN_TYPE_TEXT)
Dim Data As List
Data.Initialize
MY_Query = MYSQL.ExecQuery("SELECT * FROM tblCity")
Do While MY_Query.NextRow
Dim Rows(2) As Object
Rows(0) = MY_Query.GetInt2(0)
Rows(1) = MY_Query.GetString2(1)
Data.Add(Rows)
Loop
MY_Query.Close
B4XTable1.SetData(Data)
End Sub
private Sub B4XPage_Appear
conLinkServer
RowIDList.Initialize
End Sub
Private Sub brnLoadData_Click
ReadData
Show_Data(0)
End Sub
First when B4XPage Appear get Link to SQL Server,
Second when press Button need to read and Show Data on B4XTable,
that process work fine when run in Debug Mode, But when run in Release mode, I got Error on Reading Data as following:
"android.os.NetworkOnMainThreadException"
What Exactly the case to be take care between Debug and Release ?
many thanks in advance