If I understand well, the intention fails because your anonymous class cannot be serialized due to its handler?
Is it possible to implement your handler in the target activity? The bahaviour class should contain only a behavior function with a handler provided by the target action:
private transient Handler h;
void setHandler(Handler h){
this.h = h;
}
void startBehaviour (){
h.sendMessage();
}
void startHandlerBehaviour() {
}
source
share