B4J Question Display page after everything is loaded

Shay

Well-Known Member
Licensed User
Longtime User
Hi

currently when I load page in B4Xpages, I am getting strange effect of images and text are changes after you see the page
Since I am changing stuff in the page based on previous page click (while remaining same graphics on the next page)
How can I show the page only after everything is loaded in the code

Thanks
 

Shay

Well-Known Member
Licensed User
Longtime User
I am using: B4XPages.ShowPageAndRemovePreviousPages("Questions") in order to load next page,
and on "Questions" page:
B4X:
Private Sub B4XPage_Created (Root1 As B4XView)
    Root = Root1
    Root.LoadLayout("questions")
End Sub

Where should I use the "AddPageAndCreate "
 
Upvote 0

Shay

Well-Known Member
Licensed User
Longtime User
I also tried moving the
Root.LoadLayout("questions")
after all my code changes, but it crashes, since there are objects that are in the layout and some that I am adding to panels in the layout
 
Upvote 0

Shay

Well-Known Member
Licensed User
Longtime User
This did not solve my issue, page is displayed then pictures are changing on screen.
can I change the picture then show the page?
 
Upvote 0

Shay

Well-Known Member
Licensed User
Longtime User
Yes, beside that it is causing me new issue, consider this:
page1, you click question number, move you to page 2, which is the template to the questions
once you enter page 2, the graphics is been loaded and display and the questions text is been change.
After you answer you move to page1 , choose next question and move to page 2.
I cannot load everything before, since there are things that need to be change while page2 is loaded but before you show the page.
Do you wish to see video?
 
Upvote 0

Shay

Well-Known Member
Licensed User
Longtime User
so I can I call the page without showing it? meaning I will call the page, arrange everything and then will use the ShowPage as you wrote.
I have things that is loaded from the layout and some are dynamically added to the page via AddView.
What is in the current code showing the page after it is loaded, is it the LoadLayout? (if so I have a problem with it as described)
 
Upvote 0

Shay

Well-Known Member
Licensed User
Longtime User
Erel I understand you but on this game this technique is not working.
Let's try different approach:
how can I destroy current page (when I close it), so next time I open it, it will do the B4XPage_Created before B4XPage_Appear
since I am closing the page with B4XPages.ShowPageAndRemovePreviousPages("Page2") and it is not triggering the create..
 
Upvote 0

Shay

Well-Known Member
Licensed User
Longtime User
Thanks, But I need to load code after the layout and before showing it, so if I can run something before Appear it can help (such as Create)
do you want me to upload the project so you can see what I am talking about?
 
Upvote 0

Shay

Well-Known Member
Licensed User
Longtime User
Nice idea, will try
Do I need to declare the NextPage somewhere (beside making the function public) since it is not recognized while typing NextPage. (only B4XPages.)
 
Upvote 0

Shay

Well-Known Member
Licensed User
Longtime User
This project was my first reference,
I am now getting other issues such as
(if I call the BeforeApear) java.lang.RuntimeException: Class instance was not initialized (b4xquestions)
I don't see any way fixing this issue, if doing init before I am getting other issue, if loading the layout, other issue

I will leave it as is, thanks anyway
 
Upvote 0

Shay

Well-Known Member
Licensed User
Longtime User
Update: it seems that issue does not happen if compiling as standalone package and not by jar file
standalone is running MUCH faster than jar
 
Upvote 0
Top