eventbus-3.0.0-beta1.jar 使用


新版事件不以onEvent***來判斷執行進程了
使用:
@Subscribe(threadMode=ThreadMode.PostThread)
Method()
{}

public enum ThreadMode {
PostThread,//事件那個線程發佈,就在那個線程執行
MainThread,//在UI線程執行
BackgroundThread,//若是事件在UI線程發佈,則在新的子線程執行,若是子線程發佈,直接在該子線程執行
Async;//不論什麼線程發佈,都會在心的子線程執行

private ThreadMode() {
}
}
@Documented@Retention(RetentionPolicy.RUNTIME)@Target({ElementType.METHOD})public @interface Subscribe {    ThreadMode threadMode() default ThreadMode.PostThread;    boolean sticky() default false;    int priority() default 0;}
相關文章
相關標籤/搜索