下面是我在 GPS 关闭时提醒用户的代码。在这里,我的用户必须单击其中一个选项并进一步移动。但是,如果用户在屏幕上单击此警报以外的其他位置,则此警报会消失。如何阻止此警报对话框自动消失。请帮忙
Builder bd = new AlertDialog.Builder(myTest.this);
bd.setTitle("Alert");
bd.setMessage("GPS is disabled. Do you want to");
bd.setNegativeButton("Enable GPS", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
startActivity(new Intent(android.provider.Settings.ACTION_LOCATION_SOURCE_SETTINGS));
}});
bd.setPositiveButton("Close App", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
finish();
}
});
bd.show();