java.lang.IllegalStateException: cannot find button's onClick method in Android Studio

只愿长相守 提交于 2019-12-01 04:46:59

Ok, so I made my own test. I've put together a basic relative layout with a single button, put android:theme="@style/AppTheme" in it, and a button - app crashed with the same error. Then I removed android:theme attribute - onclick event fired as it should.

All the same happened when I used AppCompatActivity instead of now-deprecated ActionBarActivity.

It's hard for me to say why it doesn't work with android:theme. It's one of Lollipop's features, but I tried to launch in on API 5.0 emulator. The article states that currently this attribute is only supported for android.support.v7.widget.Toolbar.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!