标题: java.lang.IllegalStateException: Could not execute method of the activity [打印本页] 作者: 菜小徐 时间: 2014-7-3 21:33 标题: java.lang.IllegalStateException: Could not execute method of the activity 本帖最后由 菜小徐 于 2014-7-4 11:09 编辑
package com.itheima.send;
import java.util.ArrayList;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v7.app.ActionBarActivity;
import android.telephony.SmsManager;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText;
import android.widget.Toast;
public class MainActivity extends ActionBarActivity {
07-03 13:29:33.326: E/AndroidRuntime(1888): at com.itheima.send.MainActivity.sendsms(MainActivity.java:74)
07-03 13:29:33.326: E/AndroidRuntime(1888): ... 14 more
复制代码
numET = (EditText) findViewById(R.id.edittext1); contentET = (EditText) findViewById(R.id.edittext2); 这两句放在onCreate里面就会报java.lang.IllegalStateException: Could not execute method of the activity 这个错误,但放在自定义的方法体(sendsms)中就可以运行,求教,如何解决