Private Sub B4XPage_Appear
'Connect
End Sub
Private Sub B4XPage_Disappear
'Disconnect
End Sub
I think you should set a boolean state for page1 in service. when the page1 Activity_Pause it is false, else true.i want an if condition like as
B4X:if currentpage("page1") then dont connect to database else if currentpage("page2") then connect to database end if
This is not right for me.B4X:Dim CurrentPageId As String = B4XPages.GetPageId(Me)
Yes, in a similar way. How can I do that?I think you should set a boolean state for page1 in service. when the page1 Activity_Pause it is false, else true.
I have a chat window. If a user leave chat i want mark it leaved. But chat windows codes working behind still, i cant stop it. So if a user leave from chat page not working code.B4X:Dim CurrentPageId As String = B4XPages.GetPageId(Me)
To the picture,I could not understand your intent
You can define a global variable IscurrentPage2 for page2 in code or service module. you can set the value is true when page2 is create or resume event, false is in pause event.i want an if condition like as
B4X:if currentpage("page1") then dont connect to database else if currentpage("page2") then connect to database end if
if yourmodule.IscurrentPage2 then
connect database
else
disconnect
endif
Chat Page:Private Sub B4XPage_Appear 'Connect End Sub Private Sub B4XPage_Disappear 'Disconnect End Sub
... to get TopPageIDAlso use this to get TopPage
B4X:Dim TopPage As String = B4XPages.GetManager.GetTopPage.Id