我用于访问相机的科特林代码出现此错误 -> 未解决 reference:PERMISSION_GRANTED。请帮助我解决错误

My kotlin code to access the camera is giving this error ->unsolved reference:PERMISSION_GRANTED.Please help me to solve the error

以下是我在观看 youtube 视频时包含错误的代码(link 提供)我在使用 packageManager.PERMISSION_GRANTED 时遇到错误代码包含 名为“未解决的参考:PERMISSION_GRANTED”的错误。请帮助快速解决错误

package com.example.machineleaarningapp

import android.content.ActivityNotFoundException
import android.content.Intent
import android.graphics.Camera
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.provider.MediaStore
import android.widget.Button
import android.widget.ImageView
import android.widget.TextView
import androidx.activity.result.contract.ActivityResultContracts
import androidx.core.content.ContextCompat
import com.example.machineleaarningapp.databinding.ActivityMainBinding
import org.w3c.dom.Text
import java.security.Permission


class MainActivity : AppCompatActivity() {
    private lateinit var  binding:ActivityMainBinding
    private lateinit var  imageView: ImageView
    private lateinit var  button: Button
    private lateinit var tvOutput:TextView
    private val GALLERREQUESTCODE=123
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        binding= ActivityMainBinding.inflate(layoutInflater)
        val view=binding.root
        setContentView(R.layout.activity_main)
        setContentView(view)
        imageView=binding.imageView
        tvOutput=binding.resulttv
        button=binding.capture
        val buttonLoad=binding.Loadimage
        button.setOnClickListener{
            if(ContextCompat.checkSelfPermission(this,android.Manifest.permission.CAMERA)==packageManager.PERMISSION_GRANTED){
                takePicturePreview.lauch(null)
            }
            else{
                requestPermission.launch(android.Manifest.permission.CAMERA)
            }
        }
    }
}[I was following code on this youtube channel[\]\[1\]][1]

替换:

packageManager.PERMISSION_GRANTED

与:

PackageManager.PERMISSION_GRANTED

IOW,在 class 名称 PackageManager.

中使用大写字母 P,而不是小写字母 p