Could not find a method in the activity class android.app.Application for onClick handler on view class with id ''

Could not find a method showFragment(View) in the activity class android.app.Application for onClick handler on view class android.widget.RadioButton with id 'rbFive'

意思是你界面初始化的时候上下文传入的有误 例如你有个BaseActivity 添加一个布局文件 使用

LayoutInflater.from(context).factory.inflate(layoutId, viewGroup, attachToRoot) 

你的context使用getApplicationContext()而不是当前activity上下文 所以未包含method showFragment导致出现这个问题 替换一下就好了

LayoutInflater.from(Activity.this).factory.inflate(layoutId, viewGroup, attachToRoot) 

引用https://stackoverflow.com/questions/20832685/android-could-not-find-a-method-playaudioview-in-the-activity-class-android#

你可能感兴趣的:(Could not find a method in the activity class android.app.Application for onClick handler on view class with id '')