How to Detect Done Button Pressed On Android Device Keyboard

Hi,

First what I have done

I have a login screen with two native textfields. I am offsetting them up a bit when text input began so both of them can be seen when keyboard appear. However when keyboard done button pressed or  background touched, I need to reverse the offset operation.

Background was easy. I added a touch event listener to scene and look for target id.

However at keyboard done button I am stuck. First I tried when textfield ended editing but in Android device it didn’t work. Then I tried to catch key event at runtime but it appears key event only works for simulator.

My question is how can i detect when keyboard done button pressed?