创建一个事件对象

对于发送和接收事件,我们首先需要一个 Event 对象。事件对象实际上是简单的 POJO。

public class ArbitaryEvent{
    public static final int TYPE_1 = 1;
    public static final int TYPE_2 = 2;
    private int eventType;
    public ArbitaryEvent(int eventType){
        this.eventType = eventType;
    }
    
    public int getEventType(){
        return eventType;
    }
}