我想使用默认电话号码并将其传递到警报对话框中。这怎么可能。我试过了,但它强制关闭。请解决我的问题。提前致谢。我的编码如下:
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;
}