Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid - capture/suppress Home and EndCall buttons events?
    primarykey
    data
    text
    <p>If you ever tried to write a locker app on Android sure you meet this problem: </p> <pre><code>boolean mBackPressed = false; @Override public boolean onKeyDown(int keyCode, KeyEvent event) { if (event.getAction() == KeyEvent.ACTION_DOWN) { switch (keyCode) { case KeyEvent.KEYCODE_BACK: mBackPressed = true; break; case KeyEvent.KEYCODE_MENU: if (mBackPressed) unLock(); break; default: mBackPressed = false; showMessage(); break; } } return true; } private void showMessage() { Toast.makeText(getBaseContext(), "Back + Menu", Toast.LENGTH_SHORT) .show(); } private void unLock() { this.setResult(Activity.RESULT_OK); this.finish(); } </code></pre> <p>Seems like onKeyDown is filtering out all keys but "Back" and "Menu"...<br> <em>Well, it's not true!</em> Home button will still bring you Home screen and End Call button will run native Locker application! </p> <p>Fellow's out there also claim it as a problem:<br> <a href="http://groups.google.com/group/android-framework/browse_thread/thread/ddc9b724f0aa4fce" rel="nofollow noreferrer">How to listen from ENDCALL button</a><br> <a href="http://groups.google.co.jp/group/android-developers/msg/e5b3167d0c2768a5" rel="nofollow noreferrer">problem With Home Back screen button</a><br> <a href="http://groups.google.com/group/android-developers/browse_frm/thread/7500657bd508170" rel="nofollow noreferrer">Supressing Key presses in Activity, especially in Options Menu</a><br> <a href="http://code.google.com/p/android/issues/detail?id=4202" rel="nofollow noreferrer">Issue 4202: Feature Suggestion: permission for intercepting KEYCODE_CALL</a> </p> <p>Do you know any workaround to block two those buttons?<br> Is the only way (as often) - <em><a href="http://www.cs.bgu.ac.il/~omri/Humor/write_in_c.html" rel="nofollow noreferrer">write in C</a></em> ?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload