すでに、createした、buildersをソフトウェアキーボードを表示するためのonShow()のListenerには、使えるのですが、
コードの一番下に書いた、setPositiveButtonには、cannot resolve methodとエラーがでます。
どうすればいいのでしょうか?
java
1 2 LayoutInflater inflater = (LayoutInflater) this.getSystemService( 3 LAYOUT_INFLATER_SERVICE); 4 final View layout = inflater.inflate(R.layout.dialog_contact_us, (ViewGroup) findViewById(R.id.layout_root)); 5 6 AlertDialog.Builder builders = new AlertDialog.Builder(this); 7 8 AlertDialog builder = builders.create(); 9 builder.setView(layout); 10 11 12 builder.setOnShowListener(new DialogInterface.OnShowListener() { 13 @Override 14 public void onShow(DialogInterface arg0) { 15 EditText getusername2 = (EditText) layout.findViewById(R.id.username); 16 17 InputMethodManager inputMethodManager = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); 18 inputMethodManager.showSoftInput(getusername2, 0); 19 20 } 21 }); 22 23 builder.setPositiveButton("新規登録", new DialogInterface.OnClickListener() { 24 25
回答3件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2017/05/17 02:51