我是安卓新手。并编写此程序但出现错误。
public class First1Activity extends Activity {
/** Called when the activity is first created. */
public final static String x= "com.example.my.p";
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
public void mess(View view) {
Intent intent=new Intent(First1Activity.this,DisMess.class);
EditText edittext = (EditText) findViewById(R.id.editText1);
String m= edittext.getText().toString();
intent.putExtra(x, m);
TextView t=(TextView)findViewById(R.id.textView1);
t.setText(m);
First1Activity.this.startActivity(intent);
}
public class DisMess extends Activity{
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Intent intent = getIntent();
String message = intent.getStringExtra(First1Activity.x);
TextView textView = new TextView(this);
textView.setTextSize(40);
textView.setText(message);
setContentView(textView);
}
}
现在我得到类似:::::: 的错误
应用程序已停止工作...
我遇到错误:First1Activity.this.startActivity(intent);
请帮忙