I have a simple interface in my app - a button on the top of the screen, an EditText in the screen center and 2 more buttons at the bottom. Now I would like to use dpad to navigate thru the app's elements, everything works fine besides the EditText - basically i can browse thru the items fine, buttons get highlighted on focus, but not the EditText - it seems unresponsive even when I click the dpad center button (so the keyboard doesn't show up). For example when I have the very top element highlighted and I press down on the dpad, the top button looses focus, none of the 2 buttons at the bottom get the focus, so it looks like it's the EditText that gets the focus, but it doesn't highlight in any way, nor show the keyboard. When I click it with the coursor (or touch on the device) it's all ok.
I've tried adding the OnKeyListener to check but doesn't seem to fire off - like the EditText didn't really get the focus and the KeyEvent isn't fired on the EditText:
editKanal.setOnKeyListener(new View.OnKeyListener() {
@Override
public boolean onKey(View v, int keyCode, KeyEvent event) {
if (event.getAction() == KeyEvent.ACTION_DOWN)
if (keyCode == KeyEvent.KEYCODE_DPAD_CENTER){
Toast.makeText(getApplicationContext(), "got the focus", Toast.LENGTH_LONG).show();
return true;
}
return false;
}
});
Can anyone tell me what I am doing wrong? How do I make an EditText show the keyboard on DPAD_CENTER pressed?
Hello had this problem before most likely causes are
1-not adding focus down
2-the items not being in the same layout
please make sure both are true