Skip to content

Instantly share code, notes, and snippets.

@subodh-malgonde
Created December 22, 2015 18:54
Show Gist options
  • Save subodh-malgonde/6553ee25ac338771a17d to your computer and use it in GitHub Desktop.
Save subodh-malgonde/6553ee25ac338771a17d to your computer and use it in GitHub Desktop.
@Override
public void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
//register with the event bus
EventBus.getDefault().register(this);
// other code goes here
}
@Override
public void onDestroy(){
super.onDestroy();
//unregister from the event bus
EventBus.getDefault().unregister(this);
}
//Subscribe to the AddToCartEvent
public void onEvent(AddToCartEvent event){
Product product = event.getProduct();
//use this Product instance to update your UI
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment