android-homebutton

Back pressed events with system alert window

廉价感情. 提交于 2019-11-30 14:47:53
I need to dismiss system alert window on back pressed and home button event.I have tried with onKeyEvent but in vain. As we can't capture the back pressed event in a service, how to achieve this? Eliran Kuta Since it's a service that hosting an overlay window, It's a bit tricky solution but it is possible. You should handle these 2 cases separately (overriding home button press, and back button press). 1. Overriding home button press: Create this HomeWatcher class which contains a BroadcastReceiver that will notify when home button was pressed. Register this receiver only when your window

Back pressed events with system alert window

纵然是瞬间 提交于 2019-11-29 21:40:14
问题 I need to dismiss system alert window on back pressed and home button event.I have tried with onKeyEvent but in vain. As we can't capture the back pressed event in a service, how to achieve this? 回答1: Since it's a service that hosting an overlay window, It's a bit tricky solution but it is possible. You should handle these 2 cases separately (overriding home button press, and back button press). 1. Overriding home button press: Create this HomeWatcher class which contains a BroadcastReceiver

How To Handle Home Button In Android

时光毁灭记忆、已成空白 提交于 2019-11-29 08:37:49
I Am a New Android Developer, I know Handle The Back Button but I Don't Know How To Handle Home Button, when I Clicked Home Button, I Tried Lot Of Methods, But Not Used, Please Any One Help To Me and Solve My Problem. I have used following code, @Override public boolean onKeyDown(int keyCode, KeyEvent event) { if(keyCode==KeyEvent.KEYCODE_HOME) { Toast.makeText(this, "Click Home ", Toast.LENGTH_LONG).show(); } return super.onKeyDown(keyCode, event); } You Does not get Home Button click event .But When u press Home Button call this method @Override protected void onStop() { super.onStop(); }

How to prevent custom home launcher app restart activity?

為{幸葍}努か 提交于 2019-11-29 04:50:29
I am working on my own home launcher replacement and it works fine but one thing bothers me. When I press a home key, current home activity (the one defined in manifest as main/defualt/launcher/home) restarts - current activity instance onpause is executed and oncreate is fired again, so new activity is brought up. On the other hand, ADW launcher and LauncherPRo does not behave like that - I do not a refresh like in my case. Launcher Pro even can do several actions: If you are on the main screen with app icons, it zooms out to see a snapshot of all screens, If you open a drawer and press Home,

Overriding Home button for a Car Home replacement app

﹥>﹥吖頭↗ 提交于 2019-11-28 07:05:56
I have been working on a replacement for the stock Car Home app for a bit, and I am completely stumped on how to override the Home button so that my app will be brought back to the foreground whenever the phone is docked. This is the way that Car Home works, so there must be a way. It seems that BroadcastReceivers won't work, because the intent that is broadcast whenever the Home button is pressed will still cause the default homescreen app to launch; I cannot prevent it. I can override the Home button from within my app, but that does me no good since this needs to work when the user is

How to disable virtual home button in any activity?

爱⌒轻易说出口 提交于 2019-11-28 06:47:53
问题 I need to disable 3 virtual buttons in any activity in my app. I disabled back button and multitask button somehow but I cannot dsable home button. I tried onAttachedToWindow() style answers on stackoverflow but they didn't work for me. I don't want to disable home button for entire app, I just want to disable it for a single activity window. Thanks for your helps! 回答1: NOTE : I highly encourage you not to do this in your app, if you want to deploy it. This is only to show how we can do it.

Home button disable

半城伤御伤魂 提交于 2019-11-27 18:53:21
I do know that it is ill advice to take control of the HOME button for users. But I'm developing a android lockdown application for educational purposes. I was browsing the site and came upon this link on disabling the home button. @override public void onAttachedToWindow() { this.getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD); super.onAttachedToWindow(); } Currently I'm using the above code to disable my home button, however I do notice that even though I have this in my onCreate getWindow.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG

Altering the result of getRecentTasks

ぃ、小莉子 提交于 2019-11-27 14:14:46
I have an app designed for a tablet in a workplace setting where a number of people will use the camera as part of their routine. While it's appropriate and necessary for a supervisor to leave the app, it should be difficult for other people to accidentally do so. However, a long press of the home key is pretty easy to do accidentally. I've done it myself. That brings up a list of recent tasks; the user can tap any one of them and they're lost, since some of them aren't as sophisticated as your average smartphone owner. Programmatically you can retrieve this list via getRecentTasks. My

overriding the Home Key Long press in a category.HOME activity

☆樱花仙子☆ 提交于 2019-11-27 14:09:17
I just created my own "Home" to replace the stock android one or Sense. All is working fine and I get all I want. My only problem is to replace to long press on home key ( that usually show the last 6 activities you launched) by my own launcher. I successfully replace the long press on MENU button with this code: @Override public boolean onKeyDown(int keyCode, KeyEvent event) { //Log.i(TAG,"Keycode: "+keyCode); if (keyCode == KeyEvent.KEYCODE_MENU) { // this tells the framework to start tracking for // a long press and eventual key up. it will only // do so if this is the first down (not a

Home button disable

笑着哭i 提交于 2019-11-27 04:19:44
问题 I do know that it is ill advice to take control of the HOME button for users. But I'm developing a android lockdown application for educational purposes. I was browsing the site and came upon this link on disabling the home button. @override public void onAttachedToWindow() { this.getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD); super.onAttachedToWindow(); } Currently I'm using the above code to disable my home button, however I do notice that even though I have this in my