Android radio group onCheckChangedListener crashing app

前端 未结 3 1897
走了就别回头了
走了就别回头了 2020-12-20 08:20

Any idea why this would crash my app when I select a radio button?

I\'ve imported android.widget.RadioGroup.OnCheckedChangeListener, and I\'ve also trie

3条回答
  •  抹茶落季
    2020-12-20 09:07

    You can find the cause of the crash in these lines:

    java.lang.IllegalStateException: Could not find a method onRadioButtonClicked(View) in the activity class com.example.ringtones.MainActivity for onClick handler
    

    and

    Caused by: java.lang.NoSuchMethodException: onRadioButtonClicked [class android.view.View]
    

    The problem is that you don't have a method onRadioButtonClicked in your MainActivity. Just declare it and you'll be fine.

提交回复
热议问题