I have a customized EditText that works perfectly in all phones except for Samsung devices(not surprised..) with the Swype keyboard.
When I select the space button I get this character instead "I". When I select "add" it displays an addition character ("I") and adds the value.
Any idea what is causing this???
Here is my EditText class:
public class MyEditText extends EditText {
public MyEditText(Context context) {
super(context);
init();
}
public MyEditText(Context context, AttributeSet attrs) {
super(context, attrs);
init();
}
public MyEditText(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
init();
}
public void setTextAndResize(CharSequence text) {
setText(text);
}
private void init() {
setInputType(InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS | InputType.TYPE_TEXT_FLAG_CAP_CHARACTERS);
setKeyListener(new NumberKeyListener() {
@Override
protected char[] getAcceptedChars() {
return new char[]{
'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j',
'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't',
'u', 'v', 'w', 'x', 'y', 'z',
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J',
'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T',
'U', 'V', 'W', 'X', 'Y', 'Z',
'1', '2', '3', '4', '5', '6', '7', '8', '9', '0',
'.', '#', '+'};
}
@Override
public int getInputType() {
return InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS | InputType.TYPE_TEXT_FLAG_CAP_CHARACTERS;
}
});
}
@Override
public boolean onKeyPreIme(int keyCode, KeyEvent event) {
switch (keyCode) {
case KeyEvent.KEYCODE_BACK:
reset();
break;
}
return super.onKeyDown(keyCode, event);
}
}
0 comments:
Post a Comment