Hello
I experience error issues randomly when resuming my application. So far I have understood that they happen when I resume my application after I haven't used the phone for quite some time(with my application not started).
When I then decide to start it, I get these errors. My last opinion is that they are related to the database but I am not sure.
To make it more clear, if I Force Stop my application and start it again, I have no issues with it. Tests do load, everything else as well.
In the event of a failure, none of the Activities that use data from the Database load properly. All of them are returning error messages in Subs that retrieve information from the database.
The latest issue was:
This is the beginning of SQLL_GetTests
Here is how I initialize the DB:
Is it possible that the connection to the database is closed? Is there any time period after which this is done natively by Android or by my application as well? I am asking because I had issues with other parts of my application and wrote a Sub that initializes what is necessary for the current Activity. It's called in Resume.
So, if my connection is closed, I will have to just add DB logic to the same Sub.
The problem is this happens randomly, all of a sudden and I can't investigate too much.
Any ideas?
I experience error issues randomly when resuming my application. So far I have understood that they happen when I resume my application after I haven't used the phone for quite some time(with my application not started).
When I then decide to start it, I get these errors. My last opinion is that they are related to the database but I am not sure.
To make it more clear, if I Force Stop my application and start it again, I have no issues with it. Tests do load, everything else as well.
In the event of a failure, none of the Activities that use data from the Database load properly. All of them are returning error messages in Subs that retrieve information from the database.
The latest issue was:
An error has occured in sub: sqll_gettests (java line: 1230).
java.lang.RunTimeException:
Object should be first initialzed (cursor).
This is the beginning of SQLL_GetTests
B4X:
Dim q As String
Dim result As Cursor
Dim theList As List : theList.Initialize
q = "SELECT * FROM tests ORDER BY TEST_ID DESC"
result = ExecuteForResult(q) ' this Simply returns a cursor. I am using it to Log Queries globally.
Common.LogT("SQLL.GetTests() result = " & result, "QUERY_RESULT")
Here is how I initialize the DB:
B4X:
Sub initialize1DB()
Try
SQL1.Initialize(AppSettings.dbDir, AppSettings.dbName, False)
Common.LogT("initialize1DB() -- DB initialized", "")
Catch
Common.LogT("initialize1DB()" & LastException, "")
End Try
End Sub
Is it possible that the connection to the database is closed? Is there any time period after which this is done natively by Android or by my application as well? I am asking because I had issues with other parts of my application and wrote a Sub that initializes what is necessary for the current Activity. It's called in Resume.
So, if my connection is closed, I will have to just add DB logic to the same Sub.
The problem is this happens randomly, all of a sudden and I can't investigate too much.
Any ideas?