I'm trying to catch when the user clicks done using soft keyboard. Following code is not working, but an almost identical code is working on another page. What is wrong with this code? Debugger shows it never calls listeners. It's not calling login
function too.
I tried to add options to view file, and even custom one.
//view
<EditText
android:id="@+id/password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/prompt_password"
android:inputType="textPassword"
android:maxLines="1"/>
//java, onCreateView (b is data binding)
b.password.setImeOptions(EditorInfo.IME_ACTION_DONE);
RxTextView.editorActionEvents(b.password)
.subscribe(a -> {
login();
});
//or old way is not working too
b.password.setOnEditorActionListener((v, actionId, event) -> {
login();
return false;
});
Update: when I move statement to another function, It works.
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
RxTextView.editorActionEvents(b.password)
.subscribe(a->{
login();
});
}