1
私のアプリでは、私は少なくとも3つのAlertDialogメソッドを作成するのが良いと思っていたので、 の中にユーザーテキスト入力を使ってAlertDialogを作成しようとしています。値のユーザーを返しますHERESにコード"グローバル" AlertDialogを作成する
私のコードのサンプルの書き込みをたくさん節約具体的な方法にして、このことによってそれ に入力した
public void alrtDialog(String setTitle, String setPositiveBtn)
{
AlertDialog.Builder myDialog = new AlertDialog.Builder(context);//<--create alert dialog builder
myDialog.setTitle(setTitle);
final EditText myText = new EditText(context);
myText.setInputType(InputType.TYPE_CLASS_TEXT);
myDialog.setView(myText);
Log.e("blalba", "texoutt:" + myText.getText().toString());
myDialog.setPositiveButton(setPositiveBtn, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
setMsg(myText.getText().toString());//<--set
Log.e("blalba", "teinxt:" + myText.getText().toString());
}
});
myDialog.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.cancel();
}
});
myDialog.show();
return getMsg();
}
それはあなたを、スイートた場合にだけ、そのどこにでも – tyczj
ノートの回答を使用し、その後DialogFragemntを作成します。ちょうどチェックマークをメモするには... – GensaGames