Может быть не таким неявным, как Toast.makeText()
, но в конструкторе для AlertDialog.Builder
требуется Context
как параметр.
// creates an AlertDialog to the instance of the Context
alertDialog = new AlertDialog.Builder(this).create();
alertDialog.setTitle("Alert 1");
alertDialog.setMessage("This is an alert");
// display your dialog with an OK button.
alertDialog.setButton("OK", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
return;
} });