Intent it =newIntent(MainActivity.this, Main2Activity.class);
Bundle bd =newBundle();
bd.putString("username",nameTF.getText().toString());
bd.putString("password",passwordTF.getText().toString());
it.putExtras(bd);
startActivity(it);
TextView tv = (TextView)findViewById(R.id.textView);
Button btn = (Button)findViewById(R.id.button2);
Intent it = getIntent();
Bundle bd = it.getExtras();
String s = bd.getString("username");
tv.setText(s);
btn.setOnClickListener(newView.OnClickListener() {
@Override
public voidonClick(View view) {
Intent it2 =newIntent(Main2Activity.this, MainActivity.class);
startActivity(it2);
}
});
}
网友评论