Android Question Reload a MsgBox after an Activity Pause

rbirago

Active Member
Licensed User
Longtime User
If I want to warn the user that I'll do an action simply I can use a MsgboxAsync with a Wait For MsgboxResult and after all the operations I want to add.
In this way the user is warned, he clicks on ok and the operations are performed....
But if the user waits so long and the activity goes in Pause when the user refreshes the device to continue the msgbox doesn't appear (the form appears)! How to manage this?
Thanks
Roberto
 

JohnC

Expert
Licensed User
Longtime User
I don't know if this will work depending on your program flow, but...

Before you display the MsgBox, set a Boolean flag in a variable, and then clear the flag if the user clicks OK.

Then in the Activity_Resume check to see if this flag is still set, and if so redisplay the MsgBox.
 
Upvote 0

rbirago

Active Member
Licensed User
Longtime User
It should be a good solution if in the activity there is only one situation of this kind...but if I have more than one similar case this way is very tricky. Is it possible that there is not a straight way to manage a msgbox answer after a Pause/Resume? It is not a so strange situation...
 
Upvote 0

JohnC

Expert
Licensed User
Longtime User
So then set a numerical value to the flag so it will remember which "state" it was last in:

So when Flag=1 then display Msgbox("Do backup?")
or if Flag = 2 then MsgBox("Restore Data?"), etc.

The variable then acts like a "state machine".
 
Upvote 0

rbirago

Active Member
Licensed User
Longtime User
Yes, shurely it works. Don't you think that is really strange that there is not a straight way to manage it? If you think about this case could occur in all circumstances. So every time you want to have an acknowledge of a user you have to build this mechanism.
Anyway: thank you for the suggestion. If none has a simpler way I'll follow this way.
Roberto
 
Upvote 0

JohnC

Expert
Licensed User
Longtime User
Yeah, I would think that the msgbox should stay visible on the activity even if the activity was hidden and then made visible.
 
Upvote 0

rbirago

Active Member
Licensed User
Longtime User
Exatly, I want to believe that there is a way to achieve this.
Also because in the previous example I cannot resolve the trick by a pointer: if I have different subs that have to wait for an acknowledge of the user the problem is not to show different messages, but to continue the different operations of each specific sub!
 
Upvote 0

rbirago

Active Member
Licensed User
Longtime User
That's the solution, thanks!
but...at this point...it is a fact that Msgbox and MsgboxAsync have this important limit: don't you think that should both be considered deprecated? B4xDialog is the only all-purposes answer!
Roberto
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…