Solved! - Progress bar - value from other screen

Hi.
I have an app with 2 screens.
I dont have problem with send values from one screen/activity to other, but when i want to use that data to set progress bar app just crash without errors.
On screen2 i have button, when onClick change to screen1 and set progress bar to ex: 2 (max 6)
Screen1:

        val message = intent.getStringExtra("text_to_send")

        val textView = findViewById<ProgressBar>(R.id.progressBar).apply {
            progress = message!!.toInt()
        }
       // that code with textView generate crash app without erros

Screen2:

        val learn_button = findViewById<Button>(R.id.bLearnOk)
        learn_button.setOnClickListener {
            val change_view = Intent(this, MainActivity::class.java)
            startActivity(change_view)
            callActivity()
        }
    private fun callActivity()
        {
        val text_to_send = "1"
        Intent(this, MainActivity::class.java).also{
            it.putExtra("text_to_send", text_to_send)
            startActivity(it)

            }
        }

Please help me, its my first app :slight_smile:
Android Studio, Windows, virtual device

Answer:
Screen2:

            val intent = Intent(this, MainActivity::class.java)
            intent.putExtra("value", counter)
            startActivity(intent)

Screen1:

        val receivedIntent = intent
        val progressBar = findViewById<ProgressBar>(R.id.progressBar)
        val value = receivedIntent.getIntExtra("value", 0)
        progressBar.progress = value