I'd like to lock the screen. I want to disable the home key and only use the back key. How do I accomplish this?
相关问题
- How can I create this custom Bottom Navigation on
- Bottom Navigation View gets Shrink Down
- How to make that the snackbar action button be sho
- Listening to outgoing sms not working android
- How to create Circular view on android wear?
相关文章
- android开发 怎么把图片放入drawable的文件夹下
- android上如何获取/storage/emulated/下的文件列表
- androidStudio有个箭头不认识
- SQLite不能创建表
- Windows - Android SDK manager not listing any plat
- Animate Recycler View grid when number of columns
- Why is the app closing suddenly without showing an
- Android OverlayItem.setMarker(): Change the marker
Use this method to disable the Home key in android
Add this code to your
MainActivity
class:It's not a locking for 'home' button, but user can't switch to another app for a long time (more than 100 milliseconds), maybe this is what you want.
This solution works up to 3.x only.
Okay, this was supposed to be a hard question. But here is a way to crack it.
Override the below method in your Activity,
And now handle the key event like this,
To disable home button, try this:
Problem with notification bar pulled down can be solved by hiding notification bar like here:
or set fullscreen theme for your Activity or Application in manifest:
I found a way to tackle the HOME key. For your application set the manifest as
Now your application is an alternate Launcher application.
Use the adb, and disable the launcher application using package manager
Now the Home key press will always stay in the same screen.