Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

添加AlertDialog的问题 #15

Open
tysonwang26 opened this issue May 6, 2020 · 1 comment
Open

添加AlertDialog的问题 #15

tysonwang26 opened this issue May 6, 2020 · 1 comment

Comments

@tysonwang26
Copy link

我想在点击"我要拍照"的按钮时跳出Dialog
但是会直接闪退
请问有什么解决方法吗?
以下为"我要拍照"按钮的listener
if (ActivityCompat.checkSelfPermission(activity, Manifest.permission.CAMERA)
!= PackageManager.PERMISSION_GRANTED) {
//未授权,提起权限申请
ActivityCompat.requestPermissions(activity,
new String[]{Manifest.permission.CAMERA},
AppConstant.PERMISSION.CAMERA);
} else {
AlertDialog.Builder takePicDialog = new AlertDialog.Builder(MainActivity.this);
takePicDialog.setMessage("123");
takePicDialog.show();
CameraUtil.getInstance().camera(MainActivity.this);
}
请问有什么解法吗?
感谢

@tysonwang26
Copy link
Author

已解決
以下提供我的方法讓有相同問題的人能夠乘涼
將dialog的import改成以下:
import android.app.AlertDialog;

就解決了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant