In my app I need to be able to catch if an editText
lost focus, I've found how to do it in java but I'm not quite able to find how to do it in kotlin.
The Java answer I found was this one:
EditText txtEdit = (EditText) findViewById(R.id.edittxt);
txtEdit.setOnFocusChangeListener(new OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
if (!hasFocus) {
// code to execute when EditText loses focus
}
}
});
Can anyone help me convert this to kotlin?