6

enter image description here

In the above figure i want to listen for down arrow( i have marked it in red colour, the key one which is used to hide the keyboard). I have tried to get it action through menu options, viewconfiguration class etc. But it is not useful. Is there any method, listeners or any callback event to track this button. Please let me know your suggestions and thoughts. Any help in this regard is highly appreciable

Thanks inAdvance

Sanal Varghese
  • 1,465
  • 4
  • 23
  • 46

2 Answers2

-1

In your activity, override this method: http://developer.android.com/reference/android/app/Activity.html#onBackPressed()

Dan Osipov
  • 1,429
  • 12
  • 15
  • 1
    Have you tried it ever?? It dosen't work for me. It will not work. Actually it is not back button. Please do a revisit my button. Many will have confusions. That's why i have added the figure. I want the action for the button,(which i have marked in red). the above marked button will not trigger back button. If you click on this button it will hide keyboard and then the back button came in the position of this button and then you click on it and if you have overriden onBackpresed() method, you will get call back on it. Please do a check on it – Sanal Varghese Apr 23 '13 at 02:36
  • Hi All, I have found that many of them are confused with the way i asked the question. Now I have Updated the question. Please go through the updated question – Sanal Varghese Apr 23 '13 at 04:50
-2

If I am not you talking about this method

public boolean onKeyDown(int keyCode, KeyEvent event) {
super.onKeyDown(keyCode, event);
    switch(keyCode)
    {

    case KeyEvent.KEYCODE_BACK:
     Toast.makeText(KeyActions.this, "Pressed Back Button", Toast.LENGTH_SHORT).show();

        return true;
    }

    return false;
}
Lalit Sharma
  • 1,142
  • 1
  • 15
  • 32