By the way, I found a possible answer, while I don't know the explanation. Take a glance at the following code. Here I have put the ProgressDialogShow, which "seems" to block the OS message asking for wait or Close the App. Empirically it seems to work. I don't know whether it is actually a solution or not..
B4X:
Private Sub LeggeFile_Click
ProgressDialogShow("Reading..") ' this appears only with the following Sleep
Sleep(100)
If FileName.Length>0 Then ' a long reading operation
If File.Exists(Starter.rp.GetSafeDirDefaultExternal(""), FileName) Then
wait for (LongFileRead(FileName)) Complete (res As Boolean)
If res Then
..............
...............
End If
End If
End If
ProgressDialogHide
End Sub
Hmm Erel sometimes makes a casual remark that is often the solution to another challenge. If I'm not mistaken I read somewhere that a dialog is blocking the appearance of the next message during the display of a previous dialog. This would suppress the timeout notification of a program not responding.
The answer depends on the actual details. What is causing your app to show this dialog?
Post the code in LongFileRead.
Making it a resumable sub by itself will not do anything useful.
Do make sure to test it in release mode. It might be fast enough.