Hello, I need to open a page but without views, or that it is transparent, or that it is invisible, that is, that it is not seen that that page has been opened.
I have tried root.visible = False but the screen is white and you can't see what's underneath (the mainpage)
Is it mandatory to use a layout?
It has a solution?
Thank you.
Hello, that page performs a series of processes and checks. I used to have views to report results, but I decided to remove them because I no longer need them. Now the page doesn't have any views, but I do need it to keep going through all the processes.
Before, with the "Activity", I made it transparent by putting something like this in the manifest: SetActivityAttribute(Fpuente, android:theme, @android:style/Theme.Translucent.NoTitleBar)
Hello, that page performs a series of processes and checks. I used to have views to report results, but I decided to remove them because I no longer need them. Now the page doesn't have any views, but I do need it to keep going through all the processes.
A B4XPages class has nothing special, it is a normal class. You are not forced to visualize it using the method B4XPages.ShowPage.
Create it, declare it (I do it always in the Class_Globals of B4XMainPage, as Public object), initialize it and, as Erel wrote, add it to the B4XPages using B4XPages.AddPageAndCreate.
Once done, you can use its methods and properties from everywhere (from another B4XPage, another class, code module, service module).
Example:
B4X:
' Create this B4XPage class; name: clspagMyNeverDisplayedPage
' ... Class_Globals
'... Initialize
'
Public Sub Sum(Add1 As Int, Add2 As Int) As Long
Return Add1 + Add2
End Sub
B4X:
' B4XMainPage
Sub Class_Globals
Public NeverDisplayedPage As clspagMyNeverDisplayedPage
'...
End Sub
Private Sub B4XPage_Created (Root1 As B4XView)
'... root...
NeverDisplayedPage.Initialize
B4XPages.AddPageAndCreate("NeverDisplayedPage", NeverDisplayedPage)
End Sub
B4X:
' From now you can access all methods and properties of your "never displayed page class". From B4XMainPage:
Log(NeverDisplayedPage.Sum(1, 2))
' From other pages / code modules / services / classes:
Log(B4XPages.MainPage.NeverDisplayedPage.Sum(1, 2))
Simply do not show it, do not call B4XPages.ShowPage("NeverDisplayedPage") if you don't want to show it.
You can declare its views as Public and access them:
B4X:
B4XPages.MainPage.NeverDisplayedPage.lblOne.Text = "WOW" ' very useless, of course.
A B4XPages class has nothing special, it is a normal class. You are not forced to visualize it using the method B4XPages.ShowPage.
Create it, declare it (I do it always in the Class_Globals of B4XMainPage, as Public object), initialize it and, as Erel wrote, add it to the B4XPages using B4XPages.AddPageAndCreate.
Once done, you can use its methods and properties from everywhere (from another B4XPage, another class, code module, service module).
Excellent example @LucaMs . You have become a powerhouse and a B4XPages guru, extremely reliable.
Just a side question: Is it your preference to initialize that 2nd page in the B4XPage_Created of B4XMainPage as opposed to here:
B4X:
Public Sub Initialize
NeverDisplayedPage.Initialize 'init works here or in B4Xpage_Created
End Sub
I suppose, it does not make a difference, does it.
And if instead of "public", "private" is used: Public Private NeverDisplayedPage As clspagMyNeverDisplayedPage
It is that I have put "private" and it works anyway.
It is right?
And if instead of "public", "private" is used: Public Private NeverDisplayedPage As clspagMyNeverDisplayedPage
It is that I have put "private" and it works anyway.
It is right?
My question is not about the subs inside the class. My question is about:
Private NeverDisplayedPage As clspagMyNeverDisplayedPage
instead of:
Public NeverDisplayedPage As clspagMyNeverDisplayedPage