Just wondering how to get the soft keyboard to go away right after the app collects input from an EditText. Right now, the "Save" button collects the text and successfully sets the string in the EditText back to blank, but the soft keyboard doesn't go away until the orientation switches. I tried programmatically hiding the soft keyboard, but it's not working.
Here's the Save button code:
private OnClickListener saveButtonListener = new OnClickListener() {
@Override
public void onClick(View v) {
if (newListEditText.getText().length() > 0) { //Make sure the user actually wrote something
addStore(newListEditText.getText().toString()); //Adds a button to view with name from EditText
newListEditText.setText("");
((InputMethodManager) getSystemService(
Context.INPUT_METHOD_SERVICE)).hideSoftInputFromInputMethod(
newListEditText.getWindowToken(), 0); //Supposed to hide soft keyboard but doesn't do it
I also tried inserting the code [android:imeOptions="actionDone"] into the xml layout file, as was suggested in an answer to a similar question, but nothing changed.
Thanks in advance for your input!