Я действительно хочу сделать AlertDialog с помощью одной кнопки, может ли кто-нибудь помочь мне с этим. Спасибо!
Да, вы можете:
new AlertDialog.Builder(this)
.setIcon(R.drawable.icon)
.setTitle("Error")
.setMessage("Please fill out the entire form")
.setPositiveButton("Close", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
}
})
.create()
.show()
;
Смотрите здесь: http://developer.android.com/guide/topics/ui/dialogs.html
Используйте AlertDialog.Builder.
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
public onClick(DialogInterface dialog, int which) {
// do something interesting.
}
});
// other code to customize the dialog
Dialog d = builder.create();