This question already has an answer here:
- Alert Dialog Two Buttons 6 answers
I want to show ok and cancel button in my alert dialog.I tried many solutions but didnt succeede..guide me plese..thanks
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setMessage("Check Your Internet Connection!! you are not connected to the Internet..");
AlertDialog alert = builder.create();
alert.show();}
you can call this from anywhere like:
The following code will create a simple alert dialog with one button. In the following code
setTitle()
method is used for set Title to alert dialog.setMessage()
is used for setting message to alert dialog.setIcon()
is to set icon to alert dialog