Android-CustomCamera icon indicating copy to clipboard operation
Android-CustomCamera copied to clipboard

添加AlertDialog的问题

Open tysonwang26 opened this issue 4 years ago • 1 comments

我想在点击"我要拍照"的按钮时跳出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 avatar May 06 '20 14:05 tysonwang26

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

就解決了

tysonwang26 avatar May 07 '20 02:05 tysonwang26