Question: I'm using sticky events in EventBus to pass my "selected" objects into the upcoming Activity. The detail activity allows the user to "select" another object to fetch a new list. I want to post another sticky event with the *same* object class again into yet another list activity, but from what I understand, the previous sticky will get overwritten. See the example illustration at the bottom.

What is the recommend way around this problem? I need to have n-nested sticky events with the same class in EventBus.

I really like having sticky objects, it eliminated my need to hand-wire up the Android Parcelable interface just to send objects from one living activity to another with the `Intent` mechanism. I'd hate to be forced to go and have to implement Parcelable even after getting a fully working EventBus just because I can't have nested sticky objects!

One way I thought up was to maintain my own stack of `Item` objects in an ArrayList in a Singleton, pushing when diving deeper (before startActivity) and popping when backing out (but where? `onDestroy` is not to be used), but the approach seems extremely fragile to me. I need a robust mechanism - this is the primary navigation pivot for my app.

* List of items, user selects an `Item`. We post a sticky event with this `Item` and startActivity with detail view class in Intent.
* User browses through the detail and asks for a list of related items. We start another activity showing the list.
* User selects an `Item`. We post a sticky event with this **second** `Item` and startActivity with detail view class in Intent. The second `Item` overwrites the first `Item` and when the user wants to navigate up the back stack, it is no longer available to read, instead the last sticky item created is read.

Answer: 
By looking at the source
<https://github.com/greenrobot/EventBus/blob/master/EventBus/src/de/greenrobot/event/EventBus.java>

line 52: 

```
private final Map<Class<?>, Object> stickyEvents;

```

It uses the class as the key, so I don't think it can be done, but I thought of a work around.

You may do something similar to below when you set up your data:

```
Map<String, List> data = new HashMap<>();
data.put("CLASS_A", objectA);
data.put("CLASS_B", objectB);
EventBus.getDefault().postSticky(scheduleData);

```

On your receiving end:

```
Map<String, List> data = EventBus.getDefault().getStickyEvent(HashMap.class);
objectA = data.get("CLASS_A");
objectB = data.get("CLASS_B");

```

It is similar to intent, but at least there are less codes and you will get the speed gain
> 
> I really like having sticky objects, it eliminated my need to
>  hand-wire up the Android Parcelable interface just to send objects
>  from one living activity to another with the Intent mechanism. I'd
>  hate to be forced to go and have to implement Parcelable even after
>  getting a fully working EventBus just because I can't have nested
>  sticky objects!
> 
> 
> 

The EventBus is not intended to be used in the place of Intents and bundles. You should be sending information from one activity to another using an Intent and putting the relevant parameters in the Bundle. If you are not into writing all the Parcelable and Serializable code yourself (which i can totally understand), have a look into <https://projectlombok.org/> it will rock your world. You can implement parcelable and serializable with a single annotation.