private Handler handler = new Handler() {
public void handleMessage(android.os.Message msg) {
switch (msg.what) {
case 999:
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
imm.toggleSoftInput(0, InputMethodManager.HIDE_NOT_ALWAYS);
break;
}
};
};
在AlertDialog的show()方法调用后,发送一个消息给该handler();
handler.sendEmptyMessageDelayed(999, 400);