引入依赖
用到了两个工具类
MessageEvent
package com.anguo.event_bus;
public class MessageEvent {
public final String message;
public static MessageEvent getInstance(String message) {
return new MessageEvent(message);
}
private MessageEvent(String message) {
this.message = message;
}
}
MessageStickEvent
package com.anguo.event_bus;
public class MessageStickEvent {
public final String message;
public static MessageStickEvent getInstance(String message) {
return new MessageStickEvent(message);
}
private MessageStickEvent(String message) {
this.message = message;
}
}
demo的主页是这样