Android Question B4X page -Trying to send data not from main page

Status
Not open for further replies.

Pepebis

Member
Licensed User
Longtime User
Hello . I would like to do exact same thing but fetching this not form mainpage . Is it possible ?


B4X:
Private Sub B4XPage_Appear
    lblHello.Text = $"Hello ${B4XPages.MainPage.txtUser.Text}!"$
    
End Sub
 

DonManfred

Expert
Licensed User
Longtime User
Upvote 0

Pepebis

Member
Licensed User
Longtime User
Sometning like this :

I have edit text on page no.6 and i want to show that data on a label which is on the mainpage .
Best Regards ,
Przemek
 
Upvote 0

Mahares

Expert
Licensed User
Longtime User
@LucaMs : I tested your project. It works, but you do not have to declare public: You can declare as private:
B4X:
Private Page6 As clsPaga6
By the way do you intend to take a time off for your big birthday in a couple of days or spend it in your favorite place, the forum.
I had not a chance to test Manfred code.
 
Upvote 0

Pepebis

Member
Licensed User
Longtime User
@LucaMs : I tested also , it's working. This is exactly what i want. Although having some issues on my project like this :
java.lang.RuntimeException: Object should first be initialized (B4XView).
Regards ,
Przemek
 
Upvote 0

LucaMs

Expert
Licensed User
Longtime User
@LucaMs : I tested your project. It works, but you do not have to declare public: You can declare as private:
In fact, I deleted that comment; I think, however, that it is much better to declare all the pages of the project as Public in the B4XMainPage, so that you can access them directly, without having to use B4XPages.GetPage which also forces you to declare a new variable-reference to the desired page.
 
Last edited:
Upvote 0

Pepebis

Member
Licensed User
Longtime User
Think this can be related to my splash screen which is being loaded at the start then root is loading.
 
Upvote 0

Pepebis

Member
Licensed User
Longtime User
This is a project if .
I commented your solution - it should work.
When it is referring to page no. 6 it's not starting.
Best Regards
Przemek
 

Attachments

  • Dashboardtest1.zip
    229.1 KB · Views: 120
Upvote 0

LucaMs

Expert
Licensed User
Longtime User
I'm looking at your project right now, without running it.

1 - With B4XPages it is better do not put any code in the Main Activity.
2 - Don't make the Activity_Create event routine become a Resumable Sub (so don't put Sleep and the like there).
3 - Place your Splash image in the Root of B4XMainPage.

B4X:
Private Sub B4XPage_Created (Root1 As B4XView)
    Root = Root1
    B4XPages.AddPageAndCreate("Page 2",Page2)
    B4XPages.AddPageAndCreate("Settings",Page3)
    B4XPages.AddPageAndCreate("charts",Page4)
    B4XPages.AddPageAndCreate("about",Page5)
    B4XPages.AddPageAndCreate("conn", Page6)
    Wait For (ShowSplashScreen) Complete (Unused As Boolean)
    Root.LoadLayout("mainpage")
End Sub

B4X:
Sub ShowSplashScreen As ResumableSub
#if B4i
    Main.NavControl.NavigationBarVisible = False
    Root.LoadLayout("Splash")
    ImageView1.SetBitmap(xui.LoadBitmapResize(File.DirAssets, "logo.png", ImageView1.Width, ImageView1.Height, True))
    Sleep(3000)
    Root.RemoveAllViews
    Main.NavControl.NavigationBarVisible = True
 #else if B4A
    Root.LoadLayout("splash") ' <----
    Sleep(3000) ' <----
    ImageView1.RemoveViewFromParent ' <---- declare ImageView1 As B4XView here, in B4XMainPage
#End If
    Return True
End Sub

I don't have B4i, so...!
Now I tried to run your project but something is wrong with the Shared files.
 
Upvote 0

Pepebis

Member
Licensed User
Longtime User
Yeah. I don't know what is this . I used File-> export as zip files . All files are also inside . DUNO . There is another option ?
 
Upvote 0
Status
Not open for further replies.
Top