I opened my application after I am not doing any kind of operation. I leave the mobile 5 min. After 5 min when I touch the my application it is showing black screen. Is there any way to avoid this idle state?
Asked
Active
Viewed 762 times
-1
-
1Unless you have some code you need us to help with, this question is not programming related. – はると Mar 23 '10 at 07:21
-
Do you mean stop the device from going asleep? – Donal Rafferty Mar 23 '10 at 09:38
1 Answers
2
This is easy to do. Use: getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
in your onCreate method.
There is another way, called a WakeLock, but you really shouldn't use that unless you know what you're doing. See this post from one of the Android designers for more information about WakeLocks and why you shouldn't use them unless you're careful.

Community
- 1
- 1

Steve Haley
- 55,374
- 17
- 77
- 85