java.lang.ClassCastException: cannot be cast to android.widget.RadioButton错误

                                                                                     图一

错误提示如图一,错误代码如图二,mMandatoryMeasuresRg的布局代码如图三。

原因:类型强转错误,RadioGroup内部包含的三个控件的顺序分别为TextView(0),RadioButton(1),RadioButton(2)

而在设置RadioButton的默认选中时错误的强转了第0个控件TexView,导致程序崩溃。。。。。

java.lang.ClassCastException: cannot be cast to android.widget.RadioButton错误

                                                                                            图二

java.lang.ClassCastException: cannot be cast to android.widget.RadioButton错误

                                                                           图三

相关文章:

  • 2022-01-03
  • 2021-12-01
  • 2021-03-27
  • 2021-10-01
  • 2021-12-28
  • 2021-08-05
  • 2021-12-11
猜你喜欢
  • 2021-12-19
  • 2021-11-13
  • 2022-01-27
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-01
相关资源
相似解决方案