有未接来电时的警报对话框 我想在有未接来电时振动电话并显示对话警报以停止振动
要使用我正在使用此代码的对话框
AlertDialog.Builder alertDialog = new AlertDialog.Builder(MainActivity.this);
alertDialog.setTitle("Call");
alertDialog.setMessage("show this?");
// "Yes" Button
alertDialog.setPositiveButton("YES", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog,int which)
{
Toast.makeText(getApplicationContext(), "You clicked YES", Toast.LENGTH_SHORT).show();
}
});
// "NO" Button
alertDialog.setNegativeButton("NO", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
// Write your code here to invoke NO event
Toast.makeText(getApplicationContext(), "You clicked NO", Toast.LENGTH_SHORT).show();
dialog.cancel();
}
});
alertDialog.show();