I, as a young android developer, ask for help from the wise men. I have EditText, when I click on enter the keyboard is hidden, but if I change the keyboard language to Russian, then when I press enter, the keyboard is NOT hidden. I want the keyboard to hide out of dependence on the language by simply pressing enter. Please save me.[enter image description here][1]
<EditText
android:id="@+id/home_user_myself_information"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:imeOptions="actionDone"/>
addMySelfInformation(EditText)findViewById(R.id.home_user_myself_information);
addMySelfInformation.setOnKeyListener(new View.OnKeyListener() {
@Override
public boolean onKey(View v, int keyCode, KeyEvent event) {
if((event.getAction()==KeyEvent.ACTION_DOWN)&&(keyCode==KeyEvent.KEYCODE_ENTER)){
Context context=getApplicationContext();
InputMethodManager imm=(InputMethodManager)context.getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(addMySelfInformation.getWindowToken(),0);
return true;
}
return false;
}
});
}