Hello,
I am not able to fix that alone. Perhaps would you have some ideas.
I am willing to open a dialog after having chosen an image file using ContentChooser. But when returning from the ContentChooser, if the activity is paused after the dialogs had been shown, I get a crash.
main$ResumeMessagerun (java line: 298)
java.lang.NullPointerException: Attempt to read from field 'anywheresoftware.b4a.objects.ActivityWrapper b4a.example.debug.main._activity' on a null object reference
at b4a.example.debug.main$ResumeMessage.run(main.java:298)
at android.os.Handler.handleCallback(Handler.java:815)
...
after having selected the image a message box appears
press the device's Home button to put the Activity in Pause and get the crash
I have tried several methods like using CallSubDelayed or CallSubPlus to get a longer delay before showing the dialog but nothing fixes (even a long delay because the dialog is a modal one).
Sub Globals
Dim flg_success as Boolean=False
End Sub
Sub Activity_Resume
If flg_success=True Then
Msgbox("Please press the Home button to make me crash","Try it")
flg_success=False
End If
End Sub
'image selected, opens a dialog
Sub CC_Result (Success As Boolean, Dir As String, FileName As String)
If Success Then
flg_success=True
End If
End Sub
The solution you propose (using a Panel, or a custom dialog based on a panel) works great of course. But in case of a modal dialog (which holds the main thread till it is closed) we get the difficulty reported.
Too tired yesterday, I was not able to find the solution to let the Activity_Resume