Maybe you know that sinking feeling when you hand over your beloved Android smartphone, whether your niece wants to play The Sims or your friend wants to look something up on the web—you never quite know what state your device is going to come back in. The latest versions of Android have a feature that can help, and here's how to use it.

The option is called Screen pinning: It was introduced in Android 5.0 and it's been tweaked a bit in Android 5.1. It restricts whoever's using your phone (or tablet) to one particular app, and you can set a PIN or pattern unlock code to keep the device in this state (it would be pretty pointless for our purposes otherwise).

You need to enable the feature first of all. Head into Settings, tap Security and then choose Screen pinning. The two options that appear on screen let you toggle pinning on and off and associate a PIN lock with it. The exact wording of the second option will vary depending on how your Android device is currently protected.

With that done, tap the Overview button (that bottom-right square one) to see all of the apps currently in memory. Swipe the cards away until you see the one you want. When it's at the front in the center of the display, you'll see a pin icon. Tap this and the app goes full screen together with instructions on how to exit pinned mode.

Screen pinning is cancelled by pressing the Back and Overview buttons together, but of course to get into anything else your buddy or tiny relative is going to need your PIN code. It won't stop people dropping your phone onto a concrete floor or spilling coffee over it, but it's one way of restricting what others can do if you ever need to pass your device over.