0
如果位置被禁用,我想显示框并停止执行过程,直到我打开位置并返回到我的应用程序。请提供必要的建议帮助。 功能, alertDialog.setTitle(“GPS Setting”); alertDialog.setMessage(“GPS未启用,是否要进入设置菜单?”);停止执行程序,直到在android中选择dialogalert选项
alertDialog.setPositiveButton("OK ", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
Intent intent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS);
mContext.startActivity(intent);
}
});
alertDialog.setNegativeButton("Cancel ", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
dialog.cancel();
Toast.makeText(mContext, "Sorry we cannot proceed", Toast.LENGTH_SHORT).show();
}
});
alertDialog.show();// Showing Alert Message
我觉得这可能有助于您的问题https://stackoverflow.com/a/10311891/5693082 – Jerrol