In Java Code File(AlertDialog for asking user before doing any action)
buildercall = new AlertDialog.Builder(getParent());
buildercall.setTitle("Alert");
buildercall.setMessage("Are you sure to make call ?");
buildercall.setCancelable(false);
buildercall.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
// TODO Auto-generated method stub
dialog.dismiss();
Intent callIntent = new Intent(Intent.ACTION_DIAL);
callIntent.setData(Uri.parse("tel:"+phoneNo));
callIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(callIntent);
}
});
buildercall.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
// TODO Auto-generated method stub
dialog.dismiss();
}
});
AlertDialog alert1 = buildercall.create();
alert1.setIcon(R.drawable.alert);
alert1.show();
No comments:
Post a Comment