Android Question Detect inactivity layout

vironk

Member
Licensed User
Longtime User
I have an app with 2 layouts and when the 2nd is present and there is no user interaction for 30 seconds, load the 1st layout.
Please someone knows how to do this ?.
Thank you very much
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
I recommend you to use two activities.

Add a timer to the second activity that ticks every second (1000ms) and increments a global counter variable. If it reaches 30 then close the activity.
Reset the counter in any of the user related events.

Make sure to declare the timer as a process global variable. Enable it in Activity_Resume and disable in Activity_Pause.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…