Locking the Android UI I'm running Android Nougat. I would like to know whether there is a way to lock the device while watching a YouTube video or doing some other critical operation so that you don't accidentally kick yourself or of the application or page your viewing in the process.

Ideally a slider button with a lock would be ideal here.

What about newer versions of Android?

Thanks
You can use Screen pinning. That way only YouTube (or any app) pinned on the screen will be visible, and you won't by mistake start another app.

Settings -> Security -> Screen pinning. Set it to On.