Hi everyone,
I’ve recently started transitioning from Activities to B4XPages, and I’ve encountered a few issues:
On the second page, I want to remove it and go back to the first page using:
However, the problem is that the second page doesn’t seem to be removed properly. When I navigate to the second page again, it shows the same data as before. To fix this, I have to use the following code:
Why is this happening? Is the second page not actually being removed?
After this line, I want to immediately execute a B4XPages Sub. For example:
Initially, my code threw an error stating that the B4XPage wasn’t loaded yet.
To solve this, I added a Sleep(100) before the line to give the B4XPage time to load. However, when the page finishes loading, the sleep process seems to halt, and the next line (e.g., B4XPages.MainPage.ReceiveParsedData("test")) doesn’t execute at all.
Here’s a simplified example:
The problem is that when the B4XPage loads, the sleep is interrupted, and the Next lines aren’t executed.
What causes this behavior, and how can I properly handle it?
Thank you!
I’ve recently started transitioning from Activities to B4XPages, and I’ve encountered a few issues:
- Problem with Removing Pages
Let’s say I have two pages. I navigate to the second page using the following code:
B4X:
B4XPages.ShowPage("p2")
On the second page, I want to remove it and go back to the first page using:
B4X:
B4XPages.ShowPageAndRemovePreviousPages("MainPage")
However, the problem is that the second page doesn’t seem to be removed properly. When I navigate to the second page again, it shows the same data as before. To fix this, I have to use the following code:
B4X:
Root.RemoveAllViews
B4XPages.ShowPageAndRemovePreviousPages("MainPage")
Why is this happening? Is the second page not actually being removed?
- Problem with Waiting for B4XPage to Load
Let’s say, due to the app’s algorithm, the MainPage of the B4XPages library hasn’t been loaded yet. From another class or activity, I want to navigate to the MainPageActivity using:
B4X:
StartActivity("MainPageActivity")
After this line, I want to immediately execute a B4XPages Sub. For example:
B4X:
B4XPages.MainPage.ReceiveParsedData("test")
Initially, my code threw an error stating that the B4XPage wasn’t loaded yet.
To solve this, I added a Sleep(100) before the line to give the B4XPage time to load. However, when the page finishes loading, the sleep process seems to halt, and the next line (e.g., B4XPages.MainPage.ReceiveParsedData("test")) doesn’t execute at all.
Here’s a simplified example:
B4X:
StartActivity("MainPageActivity")
Sleep(100)
B4XPages.MainPage.ReceiveParsedData("test")
The problem is that when the B4XPage loads, the sleep is interrupted, and the Next lines aren’t executed.
What causes this behavior, and how can I properly handle it?
Thank you!