returnしたいusernameに値を入れたのに、
returnの値がnullとなってしまいます。どうすればいいのでしょうか?
java
1 String username; 2 3 public String newSet(LayoutInflater inflater, final Context context,View layout,InputMethodManager inputMethodManager) { 4 5 builder = new AlertDialog.Builder(context); 6 builder.setView(layout); 7 builder.setPositiveButton("新規登録", new DialogInterface.OnClickListener() { 8 9 public void onClick(DialogInterface dialog, int which) { 10 EditText getusername2 = (EditText) layout.findViewById(R.id.username); 11 username = getusername2.getText().toString(); 12 } 13 }); 14 alertDialog = builder.create(); 15 alertDialog.setOnShowListener(new DialogInterface.OnShowListener() { 16 17 @Override 18 public void onShow(DialogInterface arg0) { 19 getusername2 = (EditText) layout.findViewById(R.id.username); 20 inputMethodManager.showSoftInput(getusername2, 0); 21 } 22 }); 23 alertDialog.show(); 24 return username; 25 }
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2017/06/10 02:24
2017/06/10 02:27
2017/06/10 02:29
2017/06/10 04:05
2017/06/10 05:34 編集
2017/06/10 05:34 編集
2017/06/10 05:45
2017/06/10 05:49
2017/06/10 05:51
2017/06/10 06:05
2017/06/10 06:22
2017/06/10 06:54
2017/06/10 07:06