Closing keyboeard, submit button
I need to close the keyboard when a user presses a submit button so the data behind the keyboard can be seen. Here is how I have the button wired, but its not working.
Any ideas?
Button clearbutton = (Button)findViewById(R.id.Submitbutton);
Submitbutton.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
{
//...etc...
getWindow().setSoftInputMode(WindowManager.开发者_如何学GoLayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
}
Something like this should work (also, see this post).
Button clearbutton = (Button)findViewById(R.id.Submitbutton);
Submitbutton.setOnClickListener(new View.OnClickListener() {
public void onClick(View v){
((InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE)).hideSoftInputFromWindow(EditTextAirportCode.getWindowToken(), 0);
}
精彩评论