Skip to content

Instantly share code, notes, and snippets.

@subodh-malgonde
Last active December 24, 2015 07:56
Show Gist options
  • Save subodh-malgonde/0ce2f78fdddaaa1e9fb7 to your computer and use it in GitHub Desktop.
Save subodh-malgonde/0ce2f78fdddaaa1e9fb7 to your computer and use it in GitHub Desktop.
public class MyDatabaseHelper{
public MyDatabaseHelper(){
EventBus.getDefault().register(this);
}
// To register an async event handler you need to define onEventAsync or onEventBackgroundThread
// Here we will use onEventBackgroundThread, please check EventBus' docs for more details.
public void onEventBackgroundThread(AddToCartEvent event){
Product product = event.getProduct();
//use this Product instance to update your databse
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment