Android: Hiding the keyboard in an overrided “Done” keypress of EditText?

You can close the keyboard by doing: InputMethodManager imm = (InputMethodManager)getSystemService(INPUT_METHOD_SERVICE); imm. DeSoftInputFromWindow(getWindowToken(), 0).

I'm using Eclipse and I'm getting the two following errors: "InputMethodManager cannot be resolved to a type" and "the method getWindowToken() is undefined for the type new TextView. OnEditorActionListener(){}" I'm not much of a Java programmer so I don't know how to interpret these. Do I need to include something earlier?

– MLW Apr 18 '10 at 19:15 Try pressing Control+Shift+o to do the corresponding imports. – Macarse Apr 18 '10 at 20:15 Thanks, there was a dependency that I needed. I also had to replace getWindowToken() with v.getWindowToken() but otherwise it works great, thanks!

Now I just need to understand what it did – MLW Apr 18 '10 at 23:00.

Why not: myEditField. SetOnEditorActionListener(new TextView. OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (actionId == EditorInfo.

IME_ACTION_DONE) { mySubroutine(); } return false; } }); Just return false after you handle your code. This can be interpreted as no matter what your code (mySubroutine()) does it will still use the default action afterwards. If you return "true" you are telling that you are a happy coder and everything that needed to be done has happen in your mySubroutine() and the default action do not need to take action.

U can write this code in button's click listener,here editview ,u must write u'r editview's object InputMethodManager imm = (InputMethodManager)getSystemService(INPUT_METHOD_SERVICE); imm. DeSoftInputFromWindow(editview.getWindowToken(), 0).

Unreadable answer – AlexVogel Jul 4 at 14:28.

If you return "true" you are telling that you are a happy coder and everything that needed to be done has happen in your mySubroutine() and the default action do not need to take action.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions