I´m tryning to capture event of the front key´s Samsung galaxsy S but i don´t know the correct code, I check this:
if (event.getAction() == KeyEvent.ACTION_DOWN)
{
if(keyCode == KeyEvent.KEYCODE_HOME)
{
todoItems.add(0, myEditText.getText().toString());
aa.notifyDataSetChanged();
return true;
}
}
too with KEYCODE_DPAD_CENTER
but no capture the centre button
anyone know the keycode for this button?
Thanks you very much
you can't catch whether the home button was pressed .Using KeyCodes doesn't seem to work for HOME Android has kept the functionality of home button separate from other keys. The preferred way is to deal with onStop() of your Activity being called when the user presses HOME.
@Override
protected void onStop()
{
super.onStop();
//put your logic here
}