How to add a third button in alert dialog? I'm using an alert dialog in my code but I want to show multiple button in the dialog.
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();