In my soft keyboard I can perfectly capture the event key for deleting as below
public void onKey(int primaryCode, int[] keyCodes) {
if (primaryCode == Keyboard.KEYCODE_DELETE) {
int ccLength = composingContent.length();
if (ccLength > 1) {
composingContent.delete(ccLength - 1, ccLength);
getCurrentInputConnection().setComposingText(composingContent, ccLength - 1);
}
}
}
The problem is when the new composingContent is set, it is appended to the end of the old text. It will not clear the old content. I also used
getCurrentInputConnection().commitText(composingContent, ccLength - 1);
But this also does not clear any composing text set previously