Android Question B4xPages- passing values between pages

Pepebis

Member
Licensed User
Longtime User
Dear All ,
Trying to find an easy way to pass values between pages.
Best Regards ,
Przemyslaw
 

Pepebis

Member
Licensed User
Longtime User
I'm trying to do this in that way - pass random values to mainpage but it's showing error.
 

Attachments

  • passrandom.zip
    16 KB · Views: 235
Upvote 0

MikeSW17

Active Member
Licensed User
Longtime User
In your passrandom example, in Sub Button1_Click at line 34, you have used the string "pageTwo", it should be "pagTwo" - you have an erroneous "e".
Debug is your friend!
At least, it runs ok for me with that correction.
 
Upvote 0

angel_

Well-Known Member
Licensed User
Longtime User
Try this:


B4XMainPage:
'This event will be called once, before the page becomes visible.
Private Sub B4XPage_Created (Root1 As B4XView)
    Root = Root1
    Root.LoadLayout("MainPage")
    
    pagTwo.Initialize
    B4XPages.AddPageAndCreate("clsPagTwo", pagTwo)
End Sub

Sub passing_tolabel
    Label2.Text = pagTwo.Val

End Sub

Sub Button1_Click
    B4XPages.ShowPage("clsPagTwo")
End Sub
 
Upvote 0

Pepebis

Member
Licensed User
Longtime User
There was a mistake with that pages, navigation. Agree. Changed it already ... but still, it not showing a number on a label at main page after starting the generator on page 2 . Any suggestion?
 
Upvote 0

Pepebis

Member
Licensed User
Longtime User
B4X:
Private Sub B4XPage_Appear
    Label2.Text = pagTwo.Val
End Sub
I was not putting this sub . No is working . Thank you
 
Upvote 0
Top