I want to refresh my fragment by clicking on its button. How to do it? I try to do it like this but old version of fragment appears on the top of the screen (picture is attached):
binding.checkAnswersButton.setOnClickListener {
requireFragmentManager().beginTransaction().apply {
replace(R.id.quizFragment, QuizFragment())
.commit()
}
}
This will refresh the fragment :