Android Question [SOLVED #1 Opt 3} Passing values between pages : : Is there a workaround?

rabbitBUSH

Well-Known Member
Licensed User
Thanks for reading this post.

The issue here takes little explaining - so hang in there as the description goes along.

1. Firstly, I understand what is happening, so, eventually, the question is : Is there a work around/correction to what I am doing.

2. To replicate the issue I am querying run the small project and proceed in the following sequence :
a) click MANAGE and note that the page is filled with DUMMY stuff. Note at the top left of the panel under ENTER record details there should be text (XXX).
b) press BACK [or the LEFT arrow at the top left of the page title].
c) back on the landing page press VIEW and then press MANAGE to call the MANAGE page.
d) you will see that the XXX has been replaced by whatever label text was in the slider at the top of the VIEW page panel.

What this has told you/us, is that the labels and so on, on the MANAGE panel, have been inialised by the first invocation of the MANAGE button {B4XPage_Created} to pull up the MANAGE panel.

3. NOW, restart the APP from the IDE.
a) THIS TIME press VIEW first {at this point you might see where this is going].
b) You can now select a new item from the slider bar - or - just click MANAGE.
c) the APP will crash.

Here's why :
To first explain : what is happening is that the VIEW page, when the user selects to MANAGE the current record, passes values to the MANAGE page panel. When logged the values are arriving on the destination page. All working at this point.
a) It crashes because the receiving label on the destination page has not been INITIALISED. Because of the mechanism used to pass the value/s across, B4xPage_Appear nor B4XPage_Created are being visited so nothing gets initialised because the SUB called to receive the value fires first (Public Sub NewValue(Value As String))).

I tried a number of things to find a solution - but none have appeared.

SO, there are a couple of outcomes here :
1) I abandon the MANAGE button on the VIEW page and rework the MANAGE page with a data picker.
2) There is a work around that I have not found (but I rather think that this is not going to be available, meaning I will have to go with the route in 1) above. Mostly, the point is that I am thinking of removing the MANAGE button from the landing page.
3) The idiot above my eye-brows has made a fundamentally fatal error of coding and someone will point to the solution.

I used @LucaMS's example when he responded to an earlier question about how to pass values between pages. The example passed a value between MainPage and ONE other secondary page. In my requirement the values pass between two secondary pages.

(Acknowledgement also to Alexander Stolte for the CardSlider thingy.)

(The simple date picker I THINK was amongst some of @aeric postings - can't recall - any way thanks)
 

Attachments

  • testBASE.zip
    75.4 KB · Views: 26

rabbitBUSH

Well-Known Member
Licensed User
I think you should use B4XPAges.AddPageAndCreate instead of B4XPAges.AddPage.
That way the stuff is ready for viewing even if it has has not appeared yet.
😁😁
Thanks for the quick read and response William - as the universe would have it - I thought that just after I had posted.

When I started this project I used AddPageAndCreate in B4MainPage but something went wrong about it - can't think what anymore there's a post somewhere - and someone advised to use AddPage only...... So, it looks like it would be outcome 3 😁

I'll leave this as UNSOLVED for now - until tomorrow when I can try that out.
 
Upvote 0

rabbitBUSH

Well-Known Member
Licensed User
Upvote 0

William Lancee

Well-Known Member
Licensed User
Longtime User
I hope Led Zeppelin had nothing to do with it, one way or the other.:)
Be assured it has happened to all of us. Especially when you have fixed something for another reason altogether.
Your brain just doesn't want to go there anymore.
 
Upvote 0

rabbitBUSH

Well-Known Member
Licensed User
Upvote 0
Top