Activity1:
public class Activity extend Activity
{
private Button myButton =null;
private TextView myTextView=null;
public void onCreate(Bundle saveIntstanceState)
{
super.onCreate(saveIntstancestate);
setContentView(R.layout.main);
myTextView=(TextView)findViewById(R.id.myTextView);
myButton =(Button) findViewById(R.id.myButton);
myButton.setOnClickLisener(new MyButtonListener);
}
class MyButtonListener implements OnClickListener{
public void onClick(View v)
{
Intent intent=new intent();
intent.putExtra{"textIntent","123"};
intent.setClass(Activity.this,Activity1.class);
Activity1.this.startActivity(intent);
}
}
Activity2:
public class Activity extend Activity
{
private TextView myTextView =null;
public void onCreate(Bundle saveIntstanceState)
{
super.onCreate(saveIntstancestate);
setContentView(R.layout.main1);
Intent intent=getIntent();
String value=intent.getStringExtra("textIntent");
myTextView=(TextView) findViewById(R.id.myTextView);
myTextView.setText(value);
}
}