How To setKeepScreenOn()
How can I reference the Activity
View
from with开发者_如何学运维in the onCreate()
method so I can use view.setKeepScreenOn()
.
You can get a specific view defined in your xml file like:
View view = findViewById(R.id.my_view);
You could also use android:keepScreenOn
in your layout xml to have it set automatically when your layout is inflated. See the docs.
精彩评论