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

Posted by Profete162 on Stack Overflow See other posts from Stack Overflow or by Profete162
Published on 2010-05-29T08:28:42Z Indexed on 2010/05/29 8:32 UTC
Read the original article Hit count: 651

Filed under:
|

Hello all,

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 repeat).

    event.startTracking();
    return true;
}
(...)

and this part part for the long press:

  @Override
    public boolean onKeyLongPress(int keyCode, KeyEvent event) {

        //Log.i(TAG,"LONG"+keyCode);
        Toast.makeText(Launcher.this,"LONG "+keyCode, Toast.LENGTH_SHORT).show();

        if (keyCode == KeyEvent.KEYCODE_MENU) {
        (...)

But the problem is that I wasn't able to replace the KeyEvent.KEYCODE_MENU with KeyEvent.KEYCODE_HOME

is that something locked in the code that avoid user to use a Home long press?

Thank a lot for all the information you woulg give me.

© Stack Overflow or respective owner

Related posts about android

Related posts about home

  • encfs error while decoding the data

    as seen on Ask Ubuntu - Search for 'Ask Ubuntu'
    I have installed encfs and started using it to secure all my personal & office data and it was working absolutely fine until 2 hours back. The setup is like this. I have a folder in Copy folder called OfficeData which gets synchronized with my Copy folder When I login into the system I use… >>> More

  • Magento, NGINX, PHP-FPM, APC, MEMCACHED, 16gb Ram CentOS, Spiking PHP-FPM to 100% CPU

    as seen on Server Fault - Search for 'Server Fault'
    I have been trying to resolve my issue of spiking cpu caused by php-fpm processes. I've reduced the php-fpm config settings to: pm = ondemand pm.max_children = 12 pm.start_servers = 2 pm.min_spare_servers = 2 pm.max_spare_servers = 10 pm.max_requests = 500 php_admin_value[memory_limit] = 128M Problem… >>> More

  • Building Awesome WM

    as seen on Ask Ubuntu - Search for 'Ask Ubuntu'
    Hello, I am following these steps in order to build Awesome window manager on 10.04 I am building 3.4 while the tutorial is for 3.1 I installed all of the specified dependencies including cairo. After running cd awesome-3.4 && make I get the following missing dependencies error: Running… >>> More

  • Building Awesome WM

    as seen on Server Fault - Search for 'Server Fault'
    Hello, I am following these steps in order to build Awesome window manager on 10.04 I am building 3.4 while the tutorial is for 3.1 I installed all of the specified dependencies including cairo. EDIT I ran: sudo apt-get install libxcb-xtest0-dev libxcb-property1-dev libxdg-basedir-dev libstartup-notification0-dev… >>> More

  • Building Awesome WM

    as seen on Super User - Search for 'Super User'
    Hello, I am following these steps in order to build Awesome window manager on 10.04 I am building 3.4 while the tutorial is for 3.1 I installed all of the specified dependencies including cairo. EDIT I ran: sudo apt-get install libxcb-xtest0-dev libxcb-property1-dev libxdg-basedir-dev libstartup-notification0-dev… >>> More