EventBus
EventBus copied to clipboard
when post an envent about list<*> , anyplace that Subscribe List<*> will get Event...
I hava to use instanceof to avoid add datas that I don't want....Can you add some judgment
/*instanceof to avoid some bug...*/
@Subscribe(sticky = true)
public void getMettingMem(List<MettingMem.Mem> mettings) {
for (Object obj : mettings) {
if (!(obj instanceof MettingMem.Mem)) {
return;
}
}
this.mettings = mettings;
Logger.d("msgSize"+mettings.size());
}
Do not use Generic, generic type is erased at runtime You should wrap your data
class MeetingsEvent {
public final List<MettingMem.Mem> mettings;
MeetingsEvent(List<MettingMem.Mem> mettings) {
this.mettings = mettings
}
}
@Subscribe(sticky = true)
public void getMettingMem(MeetingsEvent event) {
this.mettings = event.mettings;
Logger.d("msgSize"+this.mettings.size());
}
thank U