1

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!

1 Answers1

0

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...

Community
  • 1
  • 1
Wasim K. Memon
  • 5,979
  • 4
  • 40
  • 55
  • How about displaying the color? Is it better to load a jpg that is all red/green/yellow or there's a better way? (i.e. tell the screen to go all the same color) – ConstraintErrors Feb 24 '17 at 18:59
  • @ConstraintErrors no that will increase app size. use directly color as background or use drawable as background and then apply tint on that background drawable. that will be easy and good way. and accept the answer if you liked or helpful :-) – Wasim K. Memon Feb 26 '17 at 06:24