Android Question Continue to display question after powering off and re-displaying the screen

vecino

Well-Known Member
Licensed User
Longtime User
Hi, I don't know if it will be possible, I show the user a question to "Print (yes/no)" and they leave the application on that screen and go away, then they come back and during se time the screen was turned off by Android.
They press the home button and the screen is shown again but the message asking "Print (yes/no)" is gone.
Is it possible that the message asking is not lost?
Thank you very much.

B4X:
Msgbox2Async("Print (yes/no)","Warning","Yes","","No",Null,False)
Wait For Msgbox_Result (Result As Int)
If Result = DialogResponse.POSITIVE Then
...
 

JohnC

Expert
Licensed User
Longtime User
I would try:

1) Move the prompt into a sub-routine
2) In the new sub (that does the prompt), set a global flag to true before asking the prompt. And when the user answers the prompt, set that global flag to false.
3) In the Activity_Resume sub, check to see if this flag is set to true and if so, call the sub routine that displays the prompt.

B4X:
Sub AskPromptSub
   AskPrompt = True 'set flag

   Msgbox2Async("Print (yes/no)","Warning","Yes","","No",Null,False)
   Wait For Msgbox_Result (Result As Int)

   If Result <> DialogResponse.CANCEL then  'make sure flag is not cleared unless user answers yes or no (or handle this situation differently)
      AskPrompt = False    'clear flag
   end if

   If Result = DialogResponse.POSITIVE Then
   ...

End Sub

Sub Activity_Resume

   If AskPrompt = True
      AskPromptSub
   End if

End Sub
 
Last edited:
Upvote 1
Top