I don't know about your case but in my case qwerty keyboard is having backspace keydown/keyup events but numeric is not triggering backspace key events my android version is 4.4.2
And I have modified the code you used from those 2 posts you mentioned like this. Just use this code and your backspace keyevents will be fired
This is the extended webview class where we are defining our own onCreateInputConnection
and ExtenderInputConnection is my class which extends base input connection and its code is also given below
@Override
public InputConnection onCreateInputConnection(EditorInfo outAttrs) {
super.onCreateInputConnection(outAttrs);
//This Code is for showing Decimal point in numeric Keyboard
if ((outAttrs.inputType & InputType.TYPE_CLASS_NUMBER) == InputType.TYPE_CLASS_NUMBER)
{
outAttrs.inputType |= InputType.TYPE_NUMBER_FLAG_DECIMAL;
}
else
{
InputConnection connection = super.onCreateInputConnection(outAttrs);
return connection;
}
return new ExtenderInputConnection(this,false);
}
Here is the code for ExtenderInputConnection
import android.text.InputType;
import android.view.KeyEvent;
import android.view.View;
import android.view.inputmethod.BaseInputConnection;
import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputConnection;
public class ExtenderInputConnection extends BaseInputConnection implements InputConnection{
public ExtenderInputConnection(View targetView, boolean fullEditor) {
super(targetView, fullEditor);
// TODO Auto-generated constructor stub
}
@Override
public boolean deleteSurroundingText(int beforeLength, int afterLength) {
if (beforeLength == 1 && afterLength == 0) {
// backspace
return super.sendKeyEvent(new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_DEL));
}
return super.deleteSurroundingText(beforeLength, afterLength);
}
}