Android and lack of modality


#1

Hi, is there an effective way to provide modality in Android for a ok/cancel box as my existing code relies on the blocking nature of this window and is going to need some restructuring to deal with the calls returning immediately…

any reason not just to sit in a loop sleeping and waking up every now and then to see if a flag has been set by the callback? thx


#2

I’m afraid it’s not that simple as a modal JUCE dialog box will also call methods on the message thread so the caller cannot be blocking the message thread by waiting in a loop. We are looking into ways to fix this but they are quite complex and won’t be available anytime soon.

Best to avoid modal loops altogether.


#3

ok, thanks.

I think it’s worth maybe stressing to people these limitations - I’m faced with reworking quite a bit of code that relied on blocking responses from the user - not saying this is JUCE’s fault, but wanting to incorporate Android and it’s limitations does affect how you approach problems from the outset - I guess I found out a bit too late…