I new a object int avtivity1.I want transmit it to activity2.And only transmit reference,not copy it.I need how to do?
public class MyActivity1 extends Activity{
public void onCreate(Bundle saveInstanceState){
super.onCreate(saveInstanceState);
setContentView(R.layout.main);
myButton1 = (Button)findViewById(R.id.ButtonId1);
myButton1.setText("goto");
myButton1.setOnClickListener(new Button.OnClickListener(){
public void onClick(View v){
MyObject myObject = new MyObject();
//how to transmit the object reference to OtherActiviy
//I want only transmit,not copy the object
Intent intent = new Intent();
intent.setClass(MyActivity1.this, OtherActiviy.class);
startActivity(intent);
}
});
}
}