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