参考:http://stackoverflow.com/questions/10836525/passing-objects-in-to-fragments
There are 3 ways to pass objects to a fragment
They are:
- Passing the object through a setter is the fastest way, but state will not be restored automatically.
setArguments
withSerializable
objects is the slowest way (but okay for small objects, I think) and you have automatic state restoration.- Passing as
Parcelable
is a fast way (prefer it over 2nd one if you have collection of elements to pass), and you have automatic state restoration.
http://developer.android.com/reference/android/os/Parcelable.html