私の質問は、Android でソフト キーボードを呼び出すことです。
基本的にタッチ描画アプリである FingerPaint (API Demos) を試しています。タッチ テキスト入力インターフェイスを提供しようとして、次のように、CustomView クラス内に EditText を追加しました。
private void inputText() {
EditText newText = new EditText(getContext());
//getContext needed as we're in a class extending View, not activity
newText.setText("Text Text Text");
//'addView' is deliberately left out for invisibility
//'requestFocus' also left out
// Show soft keyboard for the user to enter the value.
InputMethodManager imm = (InputMethodManager) ConfigKey.context.getSystemService("input_method");
imm.showSoftInput(newText, InputMethodManager.SHOW_IMPLICIT);
String newTextString = newText.getText().toString();
System.out.println(newTextString);
}
EditText は問題なく追加されました (Logcat の「Text Text Text」からわかるように) が、入力用のキーボードがまったく表示されませんでした。
それを修正する方法はありますか?
どんな考えでも大歓迎です!