1. 调用系统相机拍照
if(requiredActivity().packageManager.hasSystemFeature(PackageManager.FEATURE_CAMERA_ANY)) {
      val intent = Intent(MediaStore.ACTION_IMAGE_CAPTURE)
      requiredActivity().startActivityForResult(intent, Constants.PHOTO_FROM_CAMERA)
}else
     Util.toast(R.string.no_camera)
2. 调用系统图库选择
 val intent = Intent(Intent.ACTION_PICK)
 intent.type = "image/*"
 requiredActivity().startActivityForResult(intent, Constants.PHOTO_FROM_GALLERY)
另外启动的ACTION也可以使用Intent.ACTION_GET_CONTENT










网友评论