Bob
Bob

Reputation: 23010

How can I implement 'Forward Delete' in a custom keyboard?

I am developing a custom keyboard for android. I am using KeyEvent.KEYCODE_DPAD_LEFT and KeyEvent.KEYCODE_DPAD_RIGHT for left and right arrow keys. Now I want to have forward delete key like usual keyboards and unfortunately android supports it from api level 11 using constant KeyEvent.KEYCODE_FORWARD_DEL. How can I implement forward key delete for lower Apis?

The constant value of KeyEvent.KEYCODE_FORWARD_DEL is 112. when I use its value instead, it print out character p.

How can I solve this problem?

Upvotes: 1

Views: 975

Answers (1)

Bob
Bob

Reputation: 23010

I found the solution:

getCurrentInputConnection().deleteSurroundingText(0, 1);

Upvotes: 1

Related Questions