onBack
ボタンを押すとが表示されるように操作したいAlertDialog
ので、onBackボタンを押すと変数を-1に設定します。
これは私のアラートダイアログのコードです:
protected Dialog onCreateDialog(int id)
{
switch(id)
{
case CUSTOM_DIALOG:
AlertDialog.Builder builder1;
builder1 = new AlertDialog.Builder(SecondaAttivita.this);
builder1.setView(layout);
builder1.setCancelable(true);
InputMethodManager imm = (InputMethodManager)getSystemService(
Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(testo.getWindowToken(), 0);
testo.setInputType(0);
alertDialog1 = builder1.create();
break;
default:
alertDialog1.dismiss();
alertDialog1 = null;
}
return alertDialog1;
}