java.lang.IllegalStateException: Could not find method onClickcrea(View) in a parent or ancestor Con
来源:互联网 发布:骆驼趾 知乎 编辑:程序博客网 时间:2024/05/22 04:36
java.lang.IllegalStateException: Could not find method startChat(View) in a parent or ancestor Context for android:onClick attribute defined on view class android.widget.Button with id 'Button' at android.view.View$DeclaredOnClickListener.resolveMethod(View.java:4479) at android.view.View$DeclaredOnClickListener.onClick(View.java:4443) at android.view.View.performClick(View.java:5198) at android.view.View$PerformClick.run(View.java:21147) at android.os.Handler.handleCallback(Handler.java:739) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:148) at android.app.ActivityThread.main(ActivityThread.java:5417) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
出现场景:
在一个Button中定义了onclick属性,值为startChat。
在Activity中定义一个方法。
public void startChat(View view){}
运行时,点击按钮,就会出现这个异常。
这是因为activity继承的是AppCompatActivity,默认使用的主题是@style/AppTheme
把activity的主题去掉,再运行就不会报错了。
个人建议还是使用onClickListener设置监听。
0 0
- java.lang.IllegalStateException: Could not find method onClickcrea(View) in a parent or ancestor Con
- Could not find method update(View) in a parent or ancestor Context for android:onClick attribute def
- java.lang.IllegalStateException: Could not find a method capture(View) in the activity class
- java.lang.IllegalStateException: Could not find a method false(View) in the activity class com.xuan
- java.lang.IllegalStateException: Could not find a method add(View) in the activity class haha.com.e
- android 报错 java.lang.IllegalStateException: Could not find a method next(View)
- java.lang.IllegalStateException: Could not find a method onStartSingleInstanceActivityClickLisenter(
- [Android]IllegalStateException: Could not find method onBind(View)
- java.lang.IllegalStateException: Could not execute method of the activity
- java.lang.IllegalStateException: Could not execute method of the activity
- java.lang.IllegalStateException: Could not execute method of the activity
- Could not find a method XXX(View) in the activity class
- java.lang.IllegalStateException: Fragment does not have a view
- 使用布局的Onclick属性运行出现“Could not find a method~~(View) in the activity class com.~~”
- RESTFUL提示java.lang.NoSuchMethodException: Could not find a suitable constructor in
- xfire+spring2.0整合出现[java.lang.IllegalStateException: Could not find valid implementation for: 2.0]
- Starting elasticsearch: Exception in thread "main" java.lang.IllegalStateException: Could not load p
- java.lang.IllegalStateException: The specified child already has a parent.
- 美团多渠道打包方案初体验
- Spannable支持字符串展示的多样式
- Android 移动存储---SQLite
- JAVA线程同步wait()和notify()讲解
- 透明Activity
- java.lang.IllegalStateException: Could not find method onClickcrea(View) in a parent or ancestor Con
- I()函数分析
- net.sf.json.JSONException: java.lang.NoSuchMethodException
- 进程间通信笔记(5)—互斥锁和条件变量
- yii2 批量添加数组数据
- 判断Listview滑动到了最底部(且最后一个item完整显示)
- 关于ionic基础教程的学习网址
- 有n个整数,使其前面各数顺序向后移m个位置,最后m个数变成最前面的m个数
- HDU 1176 免费馅饼(dp)