I'm having a problem with the keylistener on my android app. When testing on the emulator, it works great, but after exporting the APK and trying on my real device, it doesn't work anymore.
I saw a similar question here but the answer didn't helped me. It was telling me to add setFocusable(true); and setFocusableInTouchMode(true); to my code, but it didn't worked. (I assumed I should add this to my editView)
The code is this:
edtText.setOnKeyListener(new OnKeyListener() {
public boolean onKey(View v, int keyCode, KeyEvent event) {
if(edtText.getText().length()>0 && edtText.getText().length()<141){
btnEnviar.setEnabled(true);
}
else{
lblNumeroCaracteres.setTextColor(Color.RED);
btnEnviar.setEnabled(false);
}
lblNumeroCaracteres.setText(String.valueOf(edtText.getText().length()));
return false;
}
});
Does anyone knows how to fix this problem?
Thanks in advice!