How can I reference the Activity View from within the onCreate() method so I can use view.setKeepScreenOn().
Asked
Active
Viewed 4,813 times
1
David Snabel-Caunt
- 57,156
- 12
- 110
- 132
bugzy
- 7,036
- 9
- 41
- 44
-
See this link : "http://stackoverflow.com/questions/5712849/how-do-i-keep-the-screen-on-in-my-app" – Basher51 Nov 17 '14 at 07:51
2 Answers
3
You can get a specific view defined in your xml file like:
View view = findViewById(R.id.my_view);
Cheryl Simon
- 45,901
- 15
- 92
- 82
1
You could also use android:keepScreenOn in your layout xml to have it set automatically when your layout is inflated. See the docs.
Vadim Kotov
- 7,766
- 8
- 46
- 61
Al.
- 76
- 1