I am trying to work on sending an object of my customer class from one Activity
and display it in another Activity
.
The code for t
In my experience there are three main solutions, each with their disadvantages and advantages:
Implementing Parcelable
Implementing Serializable
Using a light-weight event bus library of some sort (for example, Greenrobot's EventBus or Square's Otto)
Parcelable - fast and Android standard, but it has lots of boilerplate code and requires hard-coded strings for reference when pulling values out the intent (non-strongly typed).
Serializable - close to zero boilerplate, but it is the slowest approach and also requires hard-coded strings when pulling values out the intent (non-strongly typed).
Event Bus - zero boilerplate, fastest approach, and does not require hard-coded strings, but it does require an additional dependency (although usually lightweight, ~40 KB)
I posted a very detailed comparison around these three approaches, including efficiency benchmarks.