How to exit from Screen Pinning - Android 5 (Emulator)

荒凉一梦 提交于 2019-12-05 11:50:12

You can unpin with an adb command: adb shell am task lock stop

We cannot exit from the Screen Pinning Mode manually from the Emulator as we will not be able to press both Back button and Recents button at same time.

However if we restart the emulator the screen pinning is turned off automatically.

There is no other way around to do it.

If there is no 'hardware button' in your emulator to do just that, you could add a button in your app with the following functionality.

public void exitScreenPinning()
{
    try
    {
        stopLockTask();
    }
    catch (Exception e)
    {
        Log.d(TAG, "Screen was unlocked already.");
    }
}

That is, if you are using the screen pinning in your own app.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!