我正在尝试通过意图将数据从一项活动发送到另一项活动。但面临强制关闭错误button click
。
第一个活动:
btn1= (Button) findViewById(R.id.Next);
et = (EditText) findViewById(R.id.edit);
btn1.setOnClickListener(new Button.OnClickListener(){
public void onClick(View v)
{
Intent intent = new Intent();
intent.setClass(ViewchangerActivity.this, DisplayActivity.class);
intent.putExtra("Name", et.getText().toString());
startActivity(intent);
}
});
第二个活动:
public void onCreate(Bundle savedinstanceState)
{
super.onCreate(savedinstanceState);
setContentView(R.layout.main2);
TextView tv = (TextView) findViewById(R.id.Name);
Bundle b = getIntent().getExtras();
String str =b.getString("Name");
tv.setText(str);
}
日志猫:
android.content.ActivityNotFoundException: Unable to find explicit activity class
{org.android/org.android.DisplayActivity}; have you declared this activity in your AndroidManifest.xml?