8000 GitHub - mozay/Android-EventBus-Example
[go: up one dir, main page]

Skip to content

mozay/Android-EventBus-Example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Android-EventBus-Example

Simple Android EventBus Project

Greenrobot’s EventBus is a tiny library that allows publish-subscribe style communication between components without requiring the components to explicitly register with one another.

That makes the data exchange between components like Activity, Fragment, Services and any kind of backgrounds threads pretty easy.

not found picture

Register:

EventBus.getDefault().register(this);

UnRegister:

EventBus.getDefault().unregister(this);

Subscribe:

@Subscribe
public void onEvent(MessageEvent event) {
Toast.makeText(this, "Hey, my message" + event.getMessage(), Toast.LENGTH_SHORT).show();
}

Post:

EventBus.getDefault().postSticky(new MessageEvent("Hey event subscriber!"));
EventBus.getDefault().post(new MessageEvent("Hey event subscriber!"));

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

0