Android Question [SOLVED] - Resumable Dialog updating XUI dialog

JMB

Active Member
Licensed User
Longtime User
My quest continues...slowly and painfully!

I am trying to use an XUI dialog to show the status of an attempt to contact to an Access Point on an ESP8266, and to then show the status as the EEPROM is programmed and the ESP is brought back to life connected to the local wifi.

I use resumable subs to do the connection to the Access Point and to program the ESP EEPROM and various other bits and pieces.

The problem is that I don't know how to update stuff on the XUI dialog in any way except by using a timer because if I run other subs that contain resumable subs, they can't access the views on the XUI dialog because those views aren't available until the WAIT FOR (RS) complete (Return as Int) type call is made, at which point the code seems to block waiting for the resumable sub dialog to complete.

I am clearly not getting the hang of the way that all this works, but I can't see a way to update the views on an XUI dialog in any other way than a timer.

I suppose I could use a timer to start the other resumable sub and that might work but it seems very... clumsy.

Sorry for the poor explanation. I've been at this for days and would appreciate a hint as to a way forward.

JMB
 

JMB

Active Member
Licensed User
Longtime User
I tried the technique of using a timer to start the resumable sub code once the dialog was visible and it seems to work. The code can now update the dialog as required. I am not sure if that's the best way to do it, but I will keep going!
 
Upvote 0

JMB

Active Member
Licensed User
Longtime User
Thanks Erel.

I will try and post a simplified version of what I am trying to do. My code has become a total mess and that's usually a pretty good indication that one is not doing things correctly!

I think I have some confusion about how I am expecting the MLWiFi library to work which I will post about in a new thread.

JMB
 
Last edited:
Upvote 0

JMB

Active Member
Licensed User
Longtime User
Hi there, just thought I would close this one off.

I re-arranged my code and managed to achieve the result I wanted.

Essentially, the Sub AttempToConnectToAccessPoint changes views on the dialog - and it works fine. Not entirely sure why it didn't work before.
B4X:
    'We set up and instantiate the Resumable sub using the dialog panel we created
    Dim rs As ResumableSub = ESPConnectionStatusDialog.ShowCustom(dialogPanel, "", "", "CANCEL")
   
    'We start to look for the Access Point
    AttemptToConnectToAccessPoint
   
    'And we display the dialog and wait for a results
    Wait For (rs) Complete (Result As Int)
    timerCountDownToStopSearchingForAccessPoint.Enabled = False

JMB
 
Upvote 0
Top