The above code is correct. It will set the value of 'port' variable in the service to the value of manager.GetString(...).
Thank you Erel. I was sure my code was correct. But, I was getting some strange behavior. The code below does pass the variable to the Service:
Sub InitializeConnectVariables
ServerService.port = manager.GetString("edit1")
Log("Port used Main: " & ServerService.port) 'variable correctly fetched
StartDialog = manager.GetBoolean("check1")
End Sub
What led me astray was that after initializing the connect variable, ServerService.port was no longer accessible for use in the Main module. The code below, in Sub Activity Create, did not display the port no, only a 0. I took this to mean that the variable was not passed to ServerService.port in Sub InitializeConnectVariables. Not so.
lblIP.Text = "Device address: " & ssocket.GetMyWifiIP & ":" & ServerService.port
msgBoxURL = ssocket.GetMyWifiIP & ":" & ServerService.port
I am using your HttpServerExample. The only changes I have made are purely cosmetic. I ran into this problem when trying to use AHPreferenceActivity to input various settings. I have tried many ways to work around this, but to no avail. The strange thing about this is, if I manually give ServerService.port a value, in the service module, as in the code below, all is well.
Public port As Int = 5555
Do you have any thoughts?
Regards