Hi all,
I've this piece of code:
This code do an internet request to http://icanhazip.com to get a public IP address.
The request always return the IP address without problems, but after I get it I want to add it to a menu item so the user can see and click on it.
On this code always Job is success, the log is correctly called but it refuses to add the menu Item.
As you can see I even pass a fake ip string to test with, but nothing change.
I have tried to add:
but nothing change, I cannot see the menu item.
This code is in Activity_Create sub.
Any suggestion to get it working ?
I've this piece of code:
B4X:
Dim job1 As HttpJob
job1.Initialize("Job1", Me)
job1.Download(URL)
Wait For JobDone (job As HttpJob)
If job.Success = True Then
WANIP = "192.168.0.1" 'ExtractIP(job.GetString)
Log ("Adding menu item: " & "WAN IP: " & WANIP)
'Activity.AddMenuItem2("WAN IP: " & WANIP,"WIPAddress", Null)
Activity.AddMenuItem3("WAN IP: " & WANIP, "WIPAddress", Null, True)
Else
Log("Job failed: " & job.ErrorMessage)
WANIP = "No WAN Internet connection"
Log ("Adding menu item: " & "WAN IP: " & WANIP)
Activity.AddMenuItem3("WAN IP: No Internet", "WIPAddress", Null, True)
End If
job.Release
This code do an internet request to http://icanhazip.com to get a public IP address.
The request always return the IP address without problems, but after I get it I want to add it to a menu item so the user can see and click on it.
On this code always Job is success, the log is correctly called but it refuses to add the menu Item.
As you can see I even pass a fake ip string to test with, but nothing change.
I have tried to add:
B4X:
Sleep(0)
DoEvents
Activity.Invalidate
This code is in Activity_Create sub.
Any suggestion to get it working ?
Last edited: