Problem
I would like to handle the back button on textfield using titanium.
I know there is an event android:back on window but it does not fire on textfield.
How can I handle the back button (or the keyboard hide event) on a textfield using titanium ?
EDIT: here is some code and clarification to illustrate what I want to say:
Step to reproduce :
- click the textfield > focus event is fired, the keyboard is shown
- hit back button > the keyboard is hidden but the blur event is not called and the textfield hasn't lost the focus
Code:
var textfield = Ti.UI.createTextfield();
textfield.addEventListener('android:back', function() {
// this method is never called, so this event does not run on textfield
});
textfield.addEventListener('focus', function() {
// this method is called at step 1
});
textfield.addEventListener('blur', function() {
// this method is not called at step 2 because
// the back button only hide the keyboard but the focus is not lost
});
// what code should I use to catch event when the keyboard is hidden
// when pressing the back button ?