Hi after searching on google i come here to ask about help. I use following method to go back when user press back button of device.
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK) {
Log.i("===BACK BUTTON PRESSED===", "BACK BUTTON");
return true;
} else {
Log.i("===ELSE BACK BUTTON PRESSED===", "ELSE BACK BUTTON");
return super.onKeyDown(keyCode, event);
}
}
But logcat does not display any log message.
W/KeyCharacterMap(517): No keyboard for id 0
W/KeyCharacterMap(517): Using default keymap: /system/usr/keychars/qwerty.kcm.bin
Please help me to find this.
EDITED QUESTION :
This is my entire class.
public class Dreams_Reminder_detail_screen extends Activity {
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK) {
moveTaskToBack(true);
GroupDreams.group.back();
return true;
}
return super.onKeyDown(keyCode, event);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.dreams_reminder_details_screen);
}
}
You can override onBackPressed() function and implement your logic there.
Please refer this android blogpost "Back and other hard keys: three stories" for more understandings.
You can overrided onKeyDown function in GroupDreams perhaps that will work
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With