I want to use default phone number and pass that in alert dialog.How it's possible. I have tried,but it force close.Please solve my issue. Thanks in advance. My coding is as follows:
case R.id.menu_settings:
String phoneNo ="123456789";
AlertDialog.Builder alert = new AlertDialog.Builder(this);
alert.setMessage("Do you want to call us?"+phoneNo);
alert.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
String uri = "123456789";
public void onClick(DialogInterface dialog, int whichButton) {
Intent intent = new Intent(Intent.ACTION_CALL);
intent.setData(Uri.parse(uri));
startActivity(intent);
}
});
alert.setNegativeButton("Ok", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
// TODO Auto-generated method stub
finish();
}
});
alert.show();
return true;
}
return false;
}