Tuesday, July 16, 2024

How To Create a Dialog in Android

 Creating a Dialog is quite easy in Android.

void showDialogToPurchase()
{
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle("Title");
builder.setMessage("Message")
.setPositiveButton("OK", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
// User clicks OK

}
})
.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int id) {
        // User cancels the dialog.
             }
            });
builder.create().show();
}

6 comments:

  1. Rajabandot menawarkan keunggulan melalui desain elegan, konektivitas lancar, optimalisasi berkelanjutan, kredibilitas tinggi, fungsionalitas praktis, interoperabilitas maksimal, inovasi progresif, keamanan terstruktur, personalisasi adaptif, serta kapabilitas unggul bagi pengunjung modern. togel 4d

    ReplyDelete
  2. The article provides readers with useful knowledge that can support better understanding and informed decision making. toko123 slot

    ReplyDelete
  3. Incredibly useful facts, value suggesting. Even so, I might claim that: tampiljitu

    ReplyDelete
  4. This is a smart blog. I mean it. You have so much knowledge about this issue, and so much passion. You also know how to make people rally behind it, obviously from the responses. ddos for hire

    ReplyDelete