如何在警报对话框中添加第三个按钮?我在我的代码中使用了一个警报对话框,但我想在对话框中显示多个按钮。
alertDialogBuilder
.setMessage("Click yes to search on google")
.setPositiveButton("Yes", new DialogInterface.OnClickListener()
{
public void onClick(
DialogInterface dialog,
int id) {
// if this button is clicked, close current activity
searchFor = contents;
Intent viewSearch = new Intent(Intent.ACTION_WEB_SEARCH);
viewSearch.putExtra(SearchManager.QUERY, searchFor);
startActivity(viewSearch);
}
})
.setNegativeButton("No", new DialogInterface.OnClickListener()
{
public void onClick(
DialogInterface dialog,
int id)
{
finish();
}
});
AlertDialog alertDialog = alertDialogBuilder.create();
alertDialog.show();