Hi Android developers

Hi Android developers,

now we're on Tokyo 10.2.3 and trying to compile and run / debug our apps for android industrial devices. One big change is the "threading" in 10.2.3.

In some cases we need blocking (sync) MessageDialogs, and in past with Berlin we had a Anonymousethread with messagedlg, which sets a boolean value to true so our "while dialogclosed=false do application.processmessages" was "waiting" till users clicks a button or closes the dialog.

Now with 10.2.3 this is different and not working any more ... Does someone has/had same problems and a solution for this?

Comments

  1. Just make your own dialog with a semi transparent TRectangle that covers the whole screen (align contents). You control when it is shown and hidden. Show and hide it in the main thread when needed. Set it's HitTest to true. Example: https://community.embarcadero.com/blogs/entry/simulating-transparent-dialog-on-firemonkey-mobile

    ReplyDelete
  2. Yusuf Zorlu if I understand well your script is already running outside main thread.
    Then you need a loop and wait for a response from the UI.

    Or if your script is running in the main thread and you are using ProcessMessages why do you need other threads?
    Wait in the loop with ProcessMessages verifying if you have a response. The callback from MessageDialog() will set the response.

    ReplyDelete
  3. Like I said, this is because in Tokyo Delphi main thread is the same as Android main thread. What you want is not what you can have, at least not the way you want it. It is how Android was designed. There are no blocking dialogs there.

    If you have to have blocking code you can only do that in another thread, not the main one.

    If you don't trust me, you can trust Google engineer stackoverflow.com - Dialogs / AlertDialogs: How to "block execution" while dialog is up (.NET-style)

    ReplyDelete

Post a Comment