Jan 16, 2012

Using FLAG_FULLSCREEN and TYPE_KEYGUARD together.

To create a lockdown application on Android, I tried to use FLAG_FULLSCREEN and TYPE_KEYGUARD simultaneously, however using only one of them worked fine but no luck using them together.

To avoid this problem, full screen feature seems to be done by AndroidManifest.xml.

To do so, add android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen" to activity node in AndroidManifest.xml and add following code to Activity class

override def onAttachedToWindow() {
getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD)
super.onAttachedToWidnow
}

No comments: