hello i am currently developing an app named Clear Up where it is suppose to detect written text or text in the camera just like the google lens  and this app is design to help people with dyslexia. so basically the text will be detected and then it will say the word using text to speech feature but i am no longer near there because i am stuck here in making a simple button that activates the camera. 
after running the program in my phone it just doesnt work and i think its in my MainActivity.kt that is wrong because i noticed that when running my main_activity.xml it just says Hello Android when i did not configured the MainActivity.kt yet.  just provide me the explanations and when i ask you to give me or revise the code just do what i tell you okay? because im sure its gonna crash this site when too much token.

here is my MainActivity.kt:
package com.androidstudio.clearup

import android.annotation.SuppressLint
import android.app.Activity
import android.content.Intent
import android.graphics.Bitmap
import android.net.Uri
import android.os.Bundle
import android.os.Environment
import android.widget.Button
import android.widget.ImageView
import androidx.activity.result.contract.ActivityResultContracts
import androidx.activity.result.ActivityResultLauncher
import androidx.activity.result.registerForActivityResult
import androidx.appcompat.app.AppCompatActivity
import androidx.core.content.FileProvider
import com.clearup.android.clearup.R
import java.io.File
import java.io.IOException
import java.text.SimpleDateFormat
import java.util.Date
import java.util.Locale

open class MainActivity : AppCompatActivity() {
    private val requestImageCapture = 1

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.main_activity)

        setupTakePictureIntent()

        val captureButton: Button = findViewById(R.id.captureButton) // Replace with your button’s ID
        captureButton.setOnClickListener {
            dispatchTakePictureIntent()
        }
    }

    private fun dispatchTakePictureIntent() {
        val photoFile: File = createImageFile()
        photoFile.also {
            imageUri = FileProvider.getUriForFile(
                this,
                "com.android.clearup.fileProvider",
                it
            )
            getImage.launch(imageUri)
        }
    }

    @SuppressLint("QueryPermissionsNeeded")
    private fun setupTakePictureIntent() {
        getImage = registerForActivityResult(ActivityResultContracts.TakePicture()) { success: Boolean ->
            if (success) {
                val imageView: ImageView = findViewById(R.id.image_layout)
                imageView.setImageURI(imageUri)
            }
        }
    }

    @Throws(IOException::class)
            private fun createImageFile(): File{
                val timestamp: String = SimpleDateFormat("yyyMMdd_HHms", Locale.getDefault()).format(Date())
                val storageDir: File = getExternalFilesDir(Environment.DIRECTORY_PICTURES)!!
                return File.createTempFile(
                    "JPEG_${timestamp}_",
                    ".jpg",
                    storageDir
                ).apply {
                    currentPhotoPath = absolutePath
                }
            }

    @Suppress("DEPRECATION")
    override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
        super.onActivityResult(requestCode, resultCode, data)

        if (requestCode == requestImageCapture && resultCode == Activity.RESULT_OK) {
            val extras = data?.extras
            val imageBitmap: Bitmap? = extras?.getParcelable("data")
            imageBitmap?.let {
                val imageView: ImageView = findViewById(R.id.image_layout)
                imageView.setImageBitmap(it)
            }
        }
    }

    private lateinit var getImage: ActivityResultLauncher<Uri>
    private lateinit var imageUri: Uri
    private var currentPhotoPath: String = ""


}


heres my main_activity.xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingLeft="20dp"
    android:paddingRight="20dp">

    <ImageView
        android:id="@+id/image_layout"
        android:layout_width="match_parent"
        android:layout_height="200dp"
        android:layout_marginTop="20dp"
        android:scaleType="centerCrop"
        android:background="@drawable/image_outline"
        android:contentDescription="@string/image_description"/>

    <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_margin="20dp"
        android:text="@string/capture_button"
        android:textSize="12sp"
        android:background="@drawable/button_background"
        android:id="@+id/captureButton" />

</LinearLayout>