Android Question How to get current page?

gacar

Active Member
i want an if condition like as

Code: Copy
if currentpage("page1") then  
dont connect to database
else if currentpage("page2") then
connect to database
end if
 
i want an if condition like as

Code: Copy
if currentpage("page1") then 
dont connect to database
else if currentpage("page2") then
connect to database
end if
I think you should set a boolean state for page1 in service. when the page1 Activity_Pause it is false, else true.
 
Upvote 0
sohbet.jpg
 
Upvote 0
To the picture,I could not understand your intent

but to the code.
i want an if condition like as

Code: Copy
if currentpage("page1") then
dont connect to database
else if currentpage("page2") then
connect to database
end if
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.

You can use the code to judge if page2 is current page
B4X: Copy
if yourmodule.IscurrentPage2 then
    connect database
    else
    disconnect
endif
 
Upvote 0
Back
Top