06/28/2022, 7:51 PM
Android - onClick function doesn't work in fragments i have a fragment in my quiz app and it has 4 buttons with onClick function " checkAnswer" like below, In activity it is okay to define the onClick func like fun checkAnswer(view : View){} But when i want to try it in a fragment, it doesn't work. I get an error: java.lang.IllegalStateException: Could not find method checkAnswer(View) in a parent or ancestor Context for android:onClick attribute defined on view class...