This has plagued me for months... (drove me nuts!)
I would try to insert a record in a table within an activity (using CallSubDelayed2) - then start another activity and presented with a Black Screen...
The solution (to date) is to call the CallSubDelayed2 within the new activity within a timer... ( as Erel stated in a found post).
https://www.b4x.com/android/forum/threads/callsubplus-callsub-with-explicit-delay.60877/
Trying to update (or insert) a record with CallSubDelayed2 outside this timer would (often) cause the screen to go blank (black) since it would hold up the main thread (took too long to process) with no way to recover... Refer to above link for reference...
I would try to insert a record in a table within an activity (using CallSubDelayed2) - then start another activity and presented with a Black Screen...
The solution (to date) is to call the CallSubDelayed2 within the new activity within a timer... ( as Erel stated in a found post).
B4X:
Sub timer_tick
Dim tt,elp As Long
tt = DateTime.Now
elp = tt - tck
Activity.Title = "Location: "&DefCM.CurrLoc
btnDone.text = "DONE"&CRLF&DefCM.ShowSeconds(elp) ' DateTime.Time(DateTime.Now)
If MakeLRec Then
LogCM.SetCurrLogStat(act_stat)
logact = LogCM.CurrLogName
CallSubDelayed2( LogServmod,"MakeLogRecord",act_stat) ' this will not cause the call to block and show a Black Screen on current activity
MakeLRec = False
Log(" Made act Log Record")
Label3.Text = logact&" ~ "&Label3.Text
End If
End Sub
https://www.b4x.com/android/forum/threads/callsubplus-callsub-with-explicit-delay.60877/
Trying to update (or insert) a record with CallSubDelayed2 outside this timer would (often) cause the screen to go blank (black) since it would hold up the main thread (took too long to process) with no way to recover... Refer to above link for reference...