Attached to my EditText
is a new
TextView.OnEditorActionListener()
public boolean onEditorAction(TextView textView, int i, KeyEvent keyEvent) {
if(i == EditorInfo.IME_ACTION_DONE){
dataSnapshot.child("add").child(child.getKey()).child("comment").getRef().setValue(String.valueOf(serviceComment.getText()));
return true;
}else{
return false;
}
}
After execution, the text inside my EditText
is cleared when I want it to persist.
Additionally, after it is cleared, and I type in the same exact thing, the code doesn't execute and the keyboard doesn't disappear until I type in something different from what I previously typed.
My ultimate goal is to have the text within my EditText
to persist after clicking done and hiding the keyboard.
Here is the XML for my EditText
<EditText
android:id="@+id/txtComment"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:background="@color/colorSecondary"
android:hint="Enter a comment"
android:imeOptions="actionDone"
android:maxLength="200"
android:maxLines="1"
android:singleLine="true"
android:textColor="@color/colorBlack"
android:textSize="14sp" />