
Untitled
By: a guest on
Aug 1st, 2012 | syntax:
None | size: 1.44 KB | hits: 9 | expires: Never
How to hide keyboard automatically after sending e-mail using emailIntent
Timer timer = new Timer();
timer.schedule(new TimerTask()
{
@Override
public void run()
{
InputMethodManager m = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
if(m != null)
{
m.toggleSoftInput(0, InputMethodManager.HIDE_IMPLICIT_ONLY);
}
}
}, 100);
}**
public void hideKeyboard(final View aView){
aView.post(new Runnable() {
@Override
public void run(){
InputMethodManager inputManager = (InputMethodManager) this.getSystemService(Context.INPUT_METHOD_SERVICE);
inputManager.hideSoftInputFromWindow(this.getCurrentFocus().getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);
}
}
}
public void showKeyboard(final View aView) {
aView.post(new Runnable() {
@Override
public void run() {
InputMethodManager inputMethodManager=(InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
inputMethodManager.toggleSoftInputFromWindow(ListingScreen.this.getCurrentFocus().getWindowToken(), InputMethodManager.SHOW_FORCED, 0);
}
});
}
android:windowSoftInputMode="stateAlwaysHidden"
android:configChanges="keyboardHidden"