Could not execute method of the activity
2016-08-03 16:26
274 查看
今天遇到了一个Could not execute method of the activity的方法错误,
最后查阅了百度,
1、是说造成这种因素的原因就是代码的顺序问题,
比如在onCreate方法中@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
username = (EditText) findViewById(R.id.username);
pwd = (EditText) findViewById(R.id.pwd);
}
最后查阅了百度,
1、是说造成这种因素的原因就是代码的顺序问题,
比如在onCreate方法中@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
username = (EditText) findViewById(R.id.username);
pwd = (EditText) findViewById(R.id.pwd);
}
如果<pre name="code" class="java" style="margin-top: 0px; margin-bottom: 10px; font-size: 13px; line-height: 24.05px; background-color: rgb(255, 255, 255);">setContentView(R.layout.activity_main);
调换了顺序,就会发生这种错误,而我查阅了下,我不是这种错误,
2、我主要是一个控件变量忘记初始化。
导致系统找不到可执行的方法变量,所以发生了<span style="font-size: 13.3333px;">Could not execute method of the activity的方法错误。</span>
<span style="font-family: 'Microsoft YaHei', 微软雅黑, Arial, 'Lucida Grande', Tahoma, sans-serif; font-size: 13px; line-height: 24.05px;"></span>
<span style="font-family: 'Microsoft YaHei', 微软雅黑, Arial, 'Lucida Grande', Tahoma, sans-serif; font-size: 13px; line-height: 24.05px;"></span>
相关文章推荐
- 解决Could not execute method of the activity
- java.lang.IllegalStateException: Could not execute method of the activity
- 新增activity报错,Could not execute method of the activity
- Android 学习之异常总结--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 execute method of the activity Android
- Could not find a method XXX(View) in the activity class
- java.lang.IllegalStateException: Could not find a method false(View) in the activity class com.xuan
- 使用布局的Onclick属性运行出现“Could not find a method~~(View) in the activity class com.~~”
- java.lang.IllegalStateException: Could not find a method capture(View) in the activity class
- method to solve the problem : Could not cast value of type 'NSManagedObject_ to
- Failed to execute request because the App-Domain could not be created. Error: 0x80131902
- the create feature task could not be completed,the coordinates or measures are out of bounds
- The process could not execute 'sp_replcmds' on ‘Server Name’
- 解决文件无法上传的问题,错误信息:System.IO.DirectoryNotFoundException: Could not find a part of the path.
- 用Reflector的插件Reflexil 报错: could not find a part of the path 'c:\documents and settings\ ……的解决办法
- 关于使用FileUpload控件报 Could not find a part of the path "X\1.jpg"
- Failed to execute request because the App-Domain could not be created. Error: 0x80131902 (方法2)
- 无法启动soapUI3.0.1 Error: the jvm could not be started. the main method may have thrown an exception