I know there's simple mechanism to pass object between activities.
I usually use Bundle
and putParcelable()
or put Serializable()
, but I know that it's actually passing raw data by packing and unpacking objects, without keeping references.
But now my problem is different - I need to pass reference to some services and other activities. Is there any way do do it?
Maybe I explain my issue on real problem:
- I have a simple class
City
, which stores among other things weather data. - I keep it in
ListFragment
and display it there. - I also have fragment with
GoogleMap
, which shows Cities on list with weather.
How should I store cities: List<City>
in my application?