java.lang.IllegalStateException: Could not find method pay(View) in a parent or ancestor Context...

android 报错 :java.lang.IllegalStateException: Could not find a method pay(View) in the activity class com.example.textswitcherdemo.MainActivity for onClick handler on view class android.widget.TextSwitcher with id 'fukuan'

java.lang.IllegalStateException: Could not find method pay(View) in a parent or ancestor Context...

java.lang.IllegalStateException: Could not find method pay(View) in a parent or ancestor Context...

这个报错是因为我们xml文件中定义的android:onClick="xxx",在mainActivity.java文件中用了private void xxx(View v),应该改为public void xxx(View v).