Giter Site home page Giter Site logo

hehonghui / androideventbus Goto Github PK

View Code? Open in Web Editor NEW
1.6K 94.0 392.0 1.43 MB

A lightweight eventbus library for android, simplifies communication between Activities, Fragments, Threads, Services, etc.

License: Apache License 2.0

Java 98.92% Kotlin 1.08%
eventbus androideventbus android

androideventbus's Introduction

AndroidEventBus

This is an EventBus library for Android. It simplifies the communication between Activities, Fragments, Threads, Services, etc. and lowers the coupling among them to a great extent, thus making simplifier codes, lower coupling possible and improving code quality.

new feature

  1. support sticky event;

AndroidEventBus is adopted in the following app

Basic Architecture

arch

AndroidEventBus is like the Observer Pattern. It will have the objects which need to subscribe events registered into the EventBus through Function “register” and store such subscription methods and subscription objects in Map. When a user posts an event somewhere, the EventBus will find corresponding subscription object in accordance with the parameter type and tag of the Event and then execute the method in subscription object. These subscription methods will be executed in the Thread Mode designated by the user. For example, mode=ThreadMode. ASNYC means the subscription method is executed in the sub-thread. Please refer to the following instructions for more details.

Code Example

You can use AndroidEventBus according to the following steps.

    1. Event-receiving Object
   
public class YourActivity extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main_activity);
        // register the receiver object
        EventBus.getDefault().register(this);
    }
    
   @Override
    protected void onDestroy() {
        // Don’t forget to unregister !!
        EventBus.getDefault().unregister(this);
        super.onDestroy();
    }
}
   
    1. Mark the receiving method of the Event-receiving Object with Subscriber annotation.
public class YourActivity extends Activity {
 
    // code ......
    
    // A receiving method with a default tag will execute on UI thread.
    @Subscriber
    private void updateUser(User user) {
        Log.e("", "### update user name = " + user.name);
    }

	// When there is a “my_tag”, only events designated with “my_tag” can 
	// trigger the function and execute on UI thread when a user posts an event.
    @Subscriber(tag = "my_tag")
    private void updateUserWithTag(User user) {
        Log.e("", "### update user with my_tag, name = " + user.name);
    }
    
	// When there is a “my_tag”, only events designated with “my_tag” can trigger the function.
	// The function will execute on the same thread as the one post function is executed on.   
    @Subscriber(tag = "my_tag", mode=ThreadMode.POST)
    private void updateUserWithMode(User user) {
        Log.e("", "### update user with my_tag, name = " + user.name);
    }

	// When there is a “my_tag”, only events designated with “my_tag” can trigger  
	// the function and execute on an independent thread when a user posts an event.
    @Subscriber(tag = "my_tag", mode = ThreadMode.ASYNC)
    private void updateUserAsync(User user) {
        Log.e("", "### update user async , name = " + user.name + ", thread name = " + Thread.currentThread().getName());
    }
}

User class is approximately as follows :

    public class User  {
        String name ;
        public User(String aName) {
            name = aName ;
        }
    }

The receiving function will use “tag” to mark receivable types of events, just like designating “action” in BroadcastReceiver, which can deliver messages precisely. Mode can designate which thread the object function will be executed on but defaultly it will be executed on UI thread for the purpose of convenient UI update for users. When the object method executes long-running operations, the “mode” can be set as ASYNC so as to be executed on sub-thread.

    1. To post an event in other components such as Activities, Fragments or Services.
    
    EventBus.getDefault().post(new User("android"));
    
    // post a event with tag, the tag is like broadcast's action
    EventBus.getDefault().post(new User("mr.simple"), "my_tag");
    
    // post sticky event
    EventBus.getDefault().postSticky(new User("sticky"));

After posting the event, the object registered with the event type will receive responsive event.

Usage

integrate with jar

It will be enough to add the jar file into the “quote” part of the Project, AndroidEventBus.AndroidEventBus.jar

Gradle

  • Add dependency in build.gradle of the Module .
dependencies {

    // add AndroidEventBus dependency
    compile 'org.simple:androideventbus:1.0.5.1'
}

Differing from the EventBus of greenrobot

  1. EventBus of greenrobot is a popular open source library but its user experience is not as friendly. For example, its subscription function is required to start with onEvent, and if a function’s execution thread needs to be designated, it is necessary to add the mode name of execution thread in the name of the function according to certain rules. This may be difficult to understand. Let’s say, if I want the receiving function of some event to be executed on the main thread, I am required to name it as onEventMainThread. What if two of my subscribers share the same parameter name and both are executed on the receiving function of the main thread? It seems impossible to deal with it in such case. And a set-in-stone function name can’t properly reflect the function of the Function, i.e., the self-documentation of the function. AndroidEventBus uses annotation to mark receiving function, by which the function name is not limited. For example, I can name the receiving function as updateUserInfo(Person info). It’s more flexible.
  2. Another difference lies in that AndroidEventBus adds an extra tag to mark the tag of receivable event of every receiving function, just like the action in Broadcast. For instance, one Broadcast corresponds to one or more actions, and you need to designate the action of a broadcast before you can publish one and the broadcast receiver can receive. EventBus of greenrobot marks whether a function can receive a certain event only by the parameter type of the function. In this way, the function can receive all the events of the same parameter type, resulting in a limited delivery principle. Let’s say, if there are two events: one is about adding user and the other is about deleting user. Their parameter types are both User. Then the EventBus of greenrobot would be lke:

private void onEventMainThread(User aUser) {
	// code 
}

If there are two receiving functions of the same parameter type and both are executed on the main thread, how to name them distinctively? Supposing that there are two functions meeting the requirements and the event is adding user, but because the EventBus judges receiving function only by parameter type of the event, both function will be executed. The strategy of AndroidEventBus is to add a “tag” for each event, and use parameter type and “tag” to jointly mark the uniqueness of the vent so as to ensure precise delivery.

These are the differences between AndroidEventBus and EventBus of greenrobot. But it is understandable for greenrobot’s approach considering performance. And what I try to express is that there are very limited quantity of events posted in an App and the performance difference is negligible while user experience is well sensible. What I need to point out is that I know little about the ins and outs of EventsBus of greenrobot and there could be errors among what I’ve mentioned. If that happens, you are more than welcome to correct me.

Comparison Of Characteristics

library Whether the subscription function can be executed on other thread features
greenrobot's EventBus yes It adopts name pattern which is efficient but inconvenient to use.
square's otto no It is convenient to use annotation but it’s not as efficient as EventBus
AndroidEventBus yes It is convenient to use annotation but it’s not as efficient as EventBus. The subscription supports tag (like the Action in Broadcast Receiver) which can make event delivery more accurate and applicable to more usage scenarios.

Proguard

-keep class org.simple.** { *; }
-keep interface org.simple.** { *; }
-keepclassmembers class * {
    @org.simple.eventbus.Subscriber <methods>;
}
-keepattributes *Annotation*

Thanks Note

I really appreciate E-pal “淡蓝色的星期三” for his proposing of bugs and feedback and I hope more and more friends will join our team of AndroidEventBus Development.

Release Note

V1.0.5 ( 2015.6.20 )

  1. fix bugs.

V1.0.4 ( 2015.5.23 )

  1. support Sticky Events and use WeakReference to hold the Subscriber.

V1.0.2 ( 2015.2.28 )

Solved the problem of failing to receive an event when the parameter of the subscription method is a basic type (int, Boolean, etc.)

V1.0.1 ( 2015.2.13 )

  1. Solved the problem that the subscription method can’t receive an event because the subscription method is delivered as sub-type when posting an event while it was originally of basic type.

v1.0 ( 2015.2.9 )

  1. Release an EventBus library; use @Subscriber annotation to mark subscription method
  2. The subscription method supports “tag” mark, which makes event delivery more precise.

License

Copyright (C) 2015 Mr.Simple <[email protected]>

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

     http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

androideventbus's People

Contributors

bboyfeiyu avatar creativedrewy avatar hehonghui avatar ydcool avatar yinyinnie avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

androideventbus's Issues

弱引用带来的事件不触发问题

1.0.2版正常,在1.0.4版本以上时发现某些订阅方法无法接收到事件。
使用场景简述如下:
抽象类Alistener,包含订阅事件的方法method1,tag = “TAG1”,Alistener的实现类AAAlistener。
抽象类Blistener,包含订阅事件的方法method2,tag = “TAG2”,Blistener的实现类BBBlistener。
首先EventBus注册AAAlistener,当用户在UI触发事件“TAG1”,在AAAlistener的method1方法收到事件,在method1方法中EventBus注册new BBBlistener,接着弹出对话框让用户操作,完成之后发送“TAG2”事件;正常情况应该是BBBlistener的method2接收到这个事件,实际却没有接收到。

下载源码跟踪调试后发现在DefaultEventHandler的handleEvent方法调用时,应该执行BBBlistener.method2的时候,subscription.subscriber.get()却为null。目前并未深入研究,猜测是不是因为弱引用的AAAlistener被回收导致在其方法内new的BBBlistener也被回收?

关于sticky事件的移除问题

post一条sticky事件,订阅方法执行一次,然后removeStickyEvent,退出后再post一条相同事件,订阅方法执行两次,如此依次递增,感觉像removeStickyEvent方法没有起作用,请大神指点。

依赖生成

image
怎么将自己github上面的项目打包成这种依赖呢?

EventBus.getDefault().post(true, "procress"); can't receiver

EventBus.getDefault().post(true, "procress");

@Subcriber(tag = "procress")
public void onEvent(boolean isShow){

}

使用boolean,會無法接收到,請問是否要改成

@Subcriber(tag = "procress")
public void onEvent(Boolean isShow){

}

ThreadMode.ASYNC executes in one thread only

Thanks for the great library! However something is bothering me. I am posting a message to three different methods, each has its own tag and they are set to ThreadMode.ASYNC. However they do not execute in parallel, but sequentially.

EventBus.getDefault().post(7, "test1");
EventBus.getDefault().post(7, "test2");
EventBus.getDefault().post(7, "test3");

@Subscriber(tag = "test1", mode = ThreadMode.ASYNC)
public void test1(int request){
    ...
}
...

Logcat:
04-21 23:15:19.835 E/test1﹕ Working on a task
04-21 23:15:20.936 E/test1﹕ Done -2134183543
04-21 23:15:20.936 E/test2﹕ Working on a task
04-21 23:15:22.247 E/test2﹕ Done -2134183543
04-21 23:15:22.247 E/test3﹕ Working on a task
04-21 23:15:23.058 E/test3﹕ Done -2134183543

Expected something like this:
04-21 1.1 E/test1﹕ Working on a task
04-21 1.2 E/test2﹕ Working on a task
04-21 1.3 E/test3﹕ Working on a task
04-21 2.1 E/test1﹕ Done -2134183543
04-21 2.3 E/test2﹕ Done -2134183543
04-21 2.7 E/test3﹕ Done -2134183543

一對多的情況(One Activity post to 2 fragmnet)

問題 Q

//Activity has a Fragmnet
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    EventBus.getDefault().register(this);    
    EventBus.getDefault().post("Jay Music","ticket");
}

@Subcriber(tag = "ticket")
public void onEvent(String event) {
    Log.e("","I got " + event +"ticket")
}

在Activity是沒有問題的,可以看到Log
at Activity ,Log is showing

//Fragment
@Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);
        EventBus.getDefault().register(this);    
}

@Subcriber(tag = "ticket")
public void onEvent(String event) {
    Log.e("","I got " + event +"ticket")
}

但在Fragment上卻無法顯示Log
Bug at Fragment , I can't get Log

可否建个QQ群什么的,方便用户交流。。

我之前一直在用xutils,他们建了个QQ群,遇到问题了,或者有什么不懂的,都可以直接在群里交流,方便快捷。这样还有利于你这个库的推广。好东西,大家肯定会支持的。。

Proguard Instructions

Hey, I just thought I would let you know. If you're using Proguard with this library methods with the @subscriber annotation may get compiled out of your app. So none of the event handling works - the methods aren't even there to respond. Here is what I added to the proguard rules file:

-keep class org.simple.** { *; }
-keep interface org.simple.** { *; }
-keepclassmembers class * {
    @org.simple.eventbus.Subscriber <methods>;
}

This keeps any methods that have the Subscriber annotation and the event handling works. I thought you might want to add this to your readme for others who would use the library.

支持跨module通信吗

支持跨module通信吗?比如A组件执行完任务,然后通知B组件刷新这种场景

最新版本,无法post空对象

EventBus.getDefault().post(null, LoginEvent.TAG_EVENT);
空指针异常~~
看了下源码,里面有做类型转化。。

07-28 18:28:49.449: E/AndroidRuntime(17063): java.lang.NullPointerException
07-28 18:28:49.449: E/AndroidRuntime(17063):    at org.simple.eventbus.EventBus.post(EventBus.java:188)
07-28 18:28:49.449: E/AndroidRuntime(17063):    at co.sihe.hongmi.fragment.settings.SettingFragment$4.onClick(SettingFragment.java:88)
07-28 18:28:49.449: E/AndroidRuntime(17063):    at android.view.View.performClick(View.java:4633)
07-28 18:28:49.449: E/AndroidRuntime(17063):    at android.view.View$PerformClick.run(View.java:19323)
07-28 18:28:49.449: E/AndroidRuntime(17063):    at android.os.Handler.handleCallback(Handler.java:733)
07-28 18:28:49.449: E/AndroidRuntime(17063):    at android.os.Handler.dispatchMessage(Handler.java:95)
07-28 18:28:49.449: E/AndroidRuntime(17063):    at android.os.Looper.loop(Looper.java:157)
07-28 18:28:49.449: E/AndroidRuntime(17063):    at android.app.ActivityThread.main(ActivityThread.java:5293)
07-28 18:28:49.449: E/AndroidRuntime(17063):    at java.lang.reflect.Method.invokeNative(Native Method)
07-28 18:28:49.449: E/AndroidRuntime(17063):    at java.lang.reflect.Method.invoke(Method.java:515)
07-28 18:28:49.449: E/AndroidRuntime(17063):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1265)
07-28 18:28:49.449: E/AndroidRuntime(17063):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1081)
07-28 18:28:49.449: E/AndroidRuntime(17063):    at dalvik.system.NativeStart.main(Native Method)

搜狗输入法也使用了EventBus

D/Event (15093): No subscribers registered for event class com.sogou.androidtool.event.NetChangeEvent
D/Event (15093): No subscribers registered for event class bzy

和您探讨EventBus的一些问题

如果同是在主线程上接收,参数又一样的两个接受方法, 这样的情况, 其实在EventBus没有很好地支持,其实最好的做法我觉得是 onEvent***(id, Event)的形式就更精确了
不过robot的EventBus其实也可以处理这些东西, 就是一开始在设计是就把所有事件类,如AEvent, BEvent, CEvent全继承自一个基类,这个基类有一个id的参数。 这样能解决这个问题,就是麻烦些。

出现错误

java.lang.NoClassDefFoundError: org.simple.eventbus.EventBus
image

fragment中使用订阅方法的问题

如果我有一个fragment中添加一个订阅方法,fragment里面有个请求去拿数据,成功之后使用eventBus将数据post出来
现在我有一个activity,activity里面通过viewpager添加了刚才fragment的3个实例,
这个时候就会每一个fragment都能接收到3次post回来的数据,这样会有问题

所以请问eventbus针对这种fragment重用切当前页面有同一个class的多个实例的情况,post出来怎么区分呢

和您探讨EventBus的一些问题

如果同是在主线程上接收,参数又一样的两个接受方法, 这样的情况, 其实在EventBus没有很好地支持,其实最好的做法我觉得是 onEvent***(id, Event)的形式就更精确了
不过robot的EventBus其实也可以处理这些东西, 就是一开始在设计是就把所有事件类,如AEvent, BEvent, CEvent全继承自一个基类,这个基类有一个id的参数。 这样能解决这个问题,就是麻烦些。

关于 @Subscriber(tag = "my_tag",mode = ThreadMode.POST) 接收不到消息

您好,看了您的博文 感觉非常受用,想跟您请教个问题,按照文档使用AndroidEventBus 发现 接收不到EventBus.getDefault().post("my_tag"); 传递过来的消息,不知如何解决,想跟您请教一二,发生这个事情问题会出现在哪?

MainActivity
@OverRide
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.act_home);
EventBus.getDefault().register(this);
}

@Subscriber(tag = "my_tag",mode = ThreadMode.POST)
private void updateUserWithTag() {
    ToastUtils.showShort(HomeActivity.this, "Passed parameters");
}

MyActivity
//发送消息
EventBus.getDefault().post("my_tag");

看到请您能够及时回复我,谢谢~~

关于unregister是否调用的问题(1.0.4 )

我在LoginActivity注册了User实体类的回调事件(当接收到User实体类时,则认为登录成功,在其他页面接收到的时候,则刷新当前页面),LoginActivity在接收到User之后,弹出Toast告知用户已经登录成功,并且finish掉自己.期望LoginActivity在onDestroy后,能即时的注销回调,不再接收User事件.然而
这时候有可能出现Subscriber还没有被回收的情况.出现再次触发了已经onDestroy的LoginActivity..
不符合初期的期望,...这不禁让我有些疑惑.当Activity的onDestroy执行之后,Subscriber什么时机会被系统回收呢? 是否又会因此影响到之前的代码逻辑,以及unregister定位于过时方法是否合理?

小子的代码不漂亮,如果有时间请多多指教~

AndroidEventBus的优化建议

(1)EventBus里面的handleStickyEvent方法最后执行的判断条件冗余,因为通过foundEventType找到的subscription其eventType一定和foundType相等。所以判断条件只需要isTarget(subItem, subscriber)即可

(2)经过第一步之后,Subscription里面的EventType就没有被用到,可以去掉了。因为EventType在mSubscribeMap是Key的角色,Subscription本质是value的角色,value里面含有key很奇怪

(3)TargetMethod这个类,感觉有点冗余,这个类只在SubscribeMethodHunter里面使用,它从findSubcribeMethods(...)方法里面接收Method , EventType type, ThreadMode 参数,然后传递给subscibe(EventType event, TargetMethod method, Object subscriber)使用,建议把subscribe(...)方法改成 private void subscibe(EventType event, Object subscriber, Method method, ThreadMode threadMode) ,这样TargetMethod这个类也可以优化掉。

接收到数据后,界面无法更新

接收数据正常,然后我testView.setText(obj.getName);界面无法更新,我打印textView.getText().toString;都是新的数据,但是界面没有更新。

1.04版本unregister()方法的问题

我今天把AndroidEventBus升级到1.0.4,完后在处理一个fragment的时候,只要一切出这个fragment,再回来,所有的Subscriber就接收不到信息了,不切出就没事儿。

此时我是在onDestroy中调用unregister的,但我看这个方法过时,我就把它删除掉了,结果前面的问题就好了,怎么切换Fragment,也不会影响方法的调用了。

所以我想问的是,现在既然unregister过时了,以后应该用什么替代,还是就根本不用调用了?

针对README中“与greenrobot的EventBus的不同”的话题提出几点自己的看法↓↓↓

  • 针对“与greenrobot的EventBus的不同”中所指出的第一个问题,EventBus 3.x之后已经通过引入注解解决了这个问题,解放了方法名,方法名可以根据开发者的业务自己定义,体现代码的自文档性。
  • 针对“与greenrobot的EventBus的不同”中所指出的第二个问题,个人认为二次封装,引入tag没有必要,tag(或者叫type)之类的区别事件post源头的字段完全可以放在User或者UserEvent的实体类中,post事件时传且仅传实体类,多个post传递到一个Subscriber之后通过取出类中的tag(或者type)来通过if或switch来区别post的源头。

综上,本库之前相比于EventBus的优势随着EventBus的升级而式微,EventBus已经足够精简和友好了,没有必要再针对其进行二次封装,徒增学习成本和维护成本。

有時會重複接收

Hi~

我測試到 Subcriber 的 function,有時會被執行兩次

   //這個只有發過一次
    EventBus.getDefault().post(list, EventBusTag.IMTag.CHAT_GET_QUERY_MSG);
//這邊收到兩次
@Subcriber(tag = EventBusTag.IMTag.CHAT_GET_QUERY_MSG)
    public void onQueryMsgGet(List<Message> list){
        if(adapter!=null){
            adapter.clear();
            adapter.addAll(list);
            JKLog.i("","onQueryMsgGet");
        }
    }

能够支持 Sticky方式吗?

greenrobot eventbus 支持sticky,
举个例子,我把网络状态广播改成 eventbus方式,
在Application 中注册广播接收判断网络改变, 再post出去,
当前acitivity 创建时,可能早已经post了,
因此该 activity就接收不到, 之前网络连接上的事件,
当然我也可以在oncreate时,判断一下网络,
再主动 调用一下本来由于接收post 事件要调用的函数

关于sticky事件的可用性问题

Hi,
目前看来,sticky事件应该有两种情况:
1,事件发生于注册之前
2,事件发生于注册之后

现在的版本,只有在注册的时候会分发sticky事件,然而在注册完毕之后再发送的sticky事件就没有分发了,只是放在一个队列里了。
是否可以这样设计:
1,事件发生于注册之前,则在注册的时候分发sticky事件
2,事件发生在注册之后,则在发送事件的时候立即分发?

看代码中本来是实现了2的情况,然而后面的版本中被注释了,不知道是为了处理什么问题?

我做上面那种设计的起因在于,注册时机有可能在事件发生之前,也有可能在事件发生之后,因此需要无论何种情况都能正常收到事件。

现在我只能发送sticky事件的同时再发送一次普通事件,确保两种情况都能正常工作。

以上

使用jar收不到消息

你好,我用了这个版本的jar,就直接传字符串都收不到消息。在MainActivity的onCreate 中 EventBus.getDefault().register(this); 注册,onDestroy中 EventBus.getDefault().unregister(this);
在button中的点击事件发了这个 EventBus.getDefault().post(new ReceviceEvent("I am send a message"));
然后在SecondActivity 中 @subscriber(mode= ThreadMode.MAIN)
public void Message(ReceviceEvent s){
Log.e(TAG,"sting ××××××××:"+s.getMessage());
},但是却收不到消息,不知道哪出了问题。能不能帮忙解决一下?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.