テキスト入力用のダイアログを表示していますが、ハードキーボードが開いていない場合は、ソフトキーボードを自動的に表示したいと思います。Samsung Galaxyタブに表示するには、SHOW_FORCEDフラグを使用する必要がありましたが、SHOW_IMPLICITフラグが機能しませんでした。また、ダイアログを閉じるときに、キーボードを強制的に表示した場合はキーボードを閉じたいと思います。ただし、以下で使用しているコードは、Galaxyタブのキーボードを閉じません。Explicitフラグを使用して表示したためだと思います。
/* from the dialog constructor*/
InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
imm.restartInput(mEditText);
//only display if there is no hard keyboard out
Configuration config = getResources().getConfiguration();
if (config.hardKeyboardHidden == Configuration.HARDKEYBOARDHIDDEN_YES)
{
mForcedKeyboardDisplay = true;
imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0);
}
/* from the onDismiss() method*/
//if we previously forced keyboard display, force it to close
if (mForcedKeyboardDisplay)
{
InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
imm.restartInput(mEditText);
imm.hideSoftInputFromWindow(mEditText.getWindowToken(), InputMethodManager.HIDE_IMPLICIT_ONLY);
//this doesn't work either
//imm.hideSoftInputFromWindow(mEditText.getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);
//nor does this
//imm.hideSoftInputFromWindow(mEditText.getWindowToken(), 0);
}