数据发起Activity中,传入参数
btn.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
Intent intent = new Intent();
intent.putExtra("t", "Hello");
intent.setClass(MainActivity.this, TestLocationClient.class);
startActivity(intent);
}
});
在数据接受Activity中,接受数据
Intent intent = getIntent();
String str = intent.getStringExtra("t");
Toast.makeText(this, str,Toast.LENGTH_SHORT).show();