Search code examples
androidtimecolorsfullscreen

How to display a color fullscreen for X minutes?


I am trying to make a very simple app. The idea is to have the user input two times (e.g. 5min & 7min) in the main screen and then press a button to start the following fullscreen sequence:

  • Green screen from 0-5min
  • Yellow screen from 5-6.5min
  • Red screen from 7min+ until i tap the screen

I am new at doing apps (although I am not new to programming). What functions would you recommend me to go into for handling:

  1. displaying colors fullscreen
  2. handling timing (e.g. display this color for 5min, then this other color...)
  3. avoiding that the screen turns itself off while the app is displaying colors

Thanks!


Solution

  • You can do 2 things.

    1. You can implement Keep screen on using WakeLock feature. you can find more about here. this is not good idea as it may use more battery and user may remove your app for that reason.
    2. You can save value in onPause() method in bundle and you can use them again in onResume(). as these methods will gets called directly after screen goes on by user.

    For reference - How do I keep the screen on in my App?

    Hope it will helps...