Android Question How to prevent losing focus ?

Hi

Is there a way for an activity within an application don't loose the focus ?
Specifically, to prevent the screen from shutting off during long unattended operations and entering "activity pause" ?
 

JohnC

Expert
Licensed User
Longtime User
PhoneWakeState allows you to prevent the screen from turning off:


But make sure you do a ".Release" when you no longer need it otherwise the user's battery will drain quickly.

But keep in mind that the user can still click the home button which will cause your app to loose focus.
 
Upvote 0
Top