I've a problem to solve about pass reference between objects Activity.
Suppose follow situation with 3 class and 1 interface:
I don't know how pass the reference of MyEvents (_engine) to ActivityB
from ActivityA::StartActivityB()
public interface MyEvents {
public abstract void MakeThis();
}
public class Engine implements Runnable, MyEvents {
void Init(){
_th = new Thread(this);
_th.start();
}
public void run() {
....
}
void MakeThis(){
...
}
}
public class ActivityA extends Activty {
Engine _engine;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
_engine = new Engine();
_engine.Init(); // start thread
}
void StartActivityB(){
Intent intent = new Intent(ActivityA.this, ActivityB.class);
startActivity(intent);
}
}
public class ActivityB extends Activty {
MyEvents _myEvent;
ActivityB(MyEvents myEvent){
_myEvent = myEvent;
}
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
_myEvent.MakeThis();
}
}
Thanks
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en