android-homebutton

How to read the pressure sensor?

老子叫甜甜 提交于 2020-04-28 22:42:06
问题 Physical home button press can be detected easily on most of the devices: ... public class ExampleAccessibilityService extends AccessibilityService { ... @Override protected boolean onKeyEvent(KeyEvent event) { if (event.getKeyCode() == KEYCODE_HOME && event.getAction() == ACTION_DOWN) Log.d("Example", "The home key is pressed."); return super.onKeyEvent(event); } } But the code above doesn't work on some devices that have a pressure-sensitive virtual home button. I suppose these Samsung

How to override home button in android 4.0

与世无争的帅哥 提交于 2020-01-31 09:18:09
问题 I want to override the home button in my android activity. I have tried out few things related to this which are working for 2.3 and below but not for 4.0 above @Override public boolean onKeyDown(int keyCode, KeyEvent event) { if(keyCode == KeyEvent.KEYCODE_HOME) { startActivity(new Intent(this, ActivityB.class)); return true; } return super.onKeyDown(keyCode, event); } and other is way @Override public void onAttachedToWindow() { this.getWindow().setType(WindowManager.LayoutParams.TYPE

How to override home button in android 4.0

孤街醉人 提交于 2020-01-31 09:17:11
问题 I want to override the home button in my android activity. I have tried out few things related to this which are working for 2.3 and below but not for 4.0 above @Override public boolean onKeyDown(int keyCode, KeyEvent event) { if(keyCode == KeyEvent.KEYCODE_HOME) { startActivity(new Intent(this, ActivityB.class)); return true; } return super.onKeyDown(keyCode, event); } and other is way @Override public void onAttachedToWindow() { this.getWindow().setType(WindowManager.LayoutParams.TYPE

How to override home button in android 4.0

感情迁移 提交于 2020-01-31 09:17:06
问题 I want to override the home button in my android activity. I have tried out few things related to this which are working for 2.3 and below but not for 4.0 above @Override public boolean onKeyDown(int keyCode, KeyEvent event) { if(keyCode == KeyEvent.KEYCODE_HOME) { startActivity(new Intent(this, ActivityB.class)); return true; } return super.onKeyDown(keyCode, event); } and other is way @Override public void onAttachedToWindow() { this.getWindow().setType(WindowManager.LayoutParams.TYPE

How To Handle Home Button In Android

无人久伴 提交于 2020-01-10 03:22:06
问题 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); } 回答1: You Does not get Home Button click

Clicking app icon doesn't trigger onOptionsItemSelected()

谁说胖子不能爱 提交于 2019-12-31 11:41:40
问题 I'm currently working on an Android app. I would like to use the app icon in the action bar to navigate to the "home" activity. I read on this page that all that needs to be done is to add an onOptionsItemSelected and look for the id android.R.id.home . This is the code that I have implemented in my activity where I want to press the app icon to return to HomeActivity . @Override public boolean onOptionsItemSelected(MenuItem item) { switch(item.getItemId()) { case android.R.id.home: Intent

Clicking app icon doesn't trigger onOptionsItemSelected()

岁酱吖の 提交于 2019-12-31 11:41:29
问题 I'm currently working on an Android app. I would like to use the app icon in the action bar to navigate to the "home" activity. I read on this page that all that needs to be done is to add an onOptionsItemSelected and look for the id android.R.id.home . This is the code that I have implemented in my activity where I want to press the app icon to return to HomeActivity . @Override public boolean onOptionsItemSelected(MenuItem item) { switch(item.getItemId()) { case android.R.id.home: Intent

Preventing the HOME button to close activity

こ雲淡風輕ζ 提交于 2019-12-25 10:26:21
问题 I am currently using a custom AlertDialog which has a Theme.Dialog theme in a Activity that requires users to type the current password to proceed. According to Android - Is It possible to disable the click of home button i have tried most of the methods but it doesn't work. Activity - onCreate SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(PhysicalTheftDialog.this); boolean isServerRunning = sp.getBoolean("isServerRunning", false); if (isServerRunning == false) {

Preventing the HOME button to close activity

不问归期 提交于 2019-12-25 10:26:04
问题 I am currently using a custom AlertDialog which has a Theme.Dialog theme in a Activity that requires users to type the current password to proceed. According to Android - Is It possible to disable the click of home button i have tried most of the methods but it doesn't work. Activity - onCreate SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(PhysicalTheftDialog.this); boolean isServerRunning = sp.getBoolean("isServerRunning", false); if (isServerRunning == false) {

Handling Home button android for developing lock screen

大憨熊 提交于 2019-12-24 12:29:40
问题 I am developing lock screen application for that i need to disable the home button. some one told to me kept in the manifest as category as default, home but when ever device boot completed my activity launches but not finishing.because I my application is home How to handle the Home button.How Go locker application handled Home button <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> <category android:name=