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
Android Studio, Windows, virtual device