SIMPLE ALERTDIALOG
SOURCE CODE is
package com.AlertDialogExample;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.os.Bundle;
{
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
AlertDialog.Builder adb = new AlertDialog.Builder(this);
adb.setTitle("Set Title here");
adb.setMessage("Set the Text Message here");
adb.setPositiveButton("Ok", new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog, int id)
{
// Action for 'Ok' Button
}
});
adb.setNegativeButton("Cancel", new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog, int id)
{ // Action for 'Cancel' Button
dialog.cancel();
}
});
adb.setIcon(R.drawable.icon);
adb.show();
}
}The OUTPUT will be
Wow.. Simple but powerful.. It really works..
ReplyDeletehow do you get the icon in there?
ReplyDeleteNice one Man... Even this http://www.compiletimeerror.com/2013/08/android-alert-dialog-example.html might help. have a look...
ReplyDelete