I am implementing a feed of messages in a list view inside my activity. In this activity, I am showing just the "main thread" of the messages, not the replies to them, sort of social network behavior, when u click on a message, pops up a new window with that message and the replies to it.
After downloading the JSONS from the webserver, we are storating the info in complex objects which we call VO, i.e. UserVO, which storages all of the User's information.
This objects contain Strings, ints, list of other VO's, lists for the messages feeds, etc...
My idea is opening a new FragmentDialog on the top of the screen when one message is clicked for showing the possible replies to this message, and enable the possibility of sending a reply to it.
For this, I would need to pass those VO objects between the Activity and the Fragment in both directions,
- From the Activity to the DialogFragment: Object with the messages feed.
- From the Fragment to the Activity: Once the user writes the text, and attaches pictures (URL) I should send an Object back to the Activity
I have been reading quite a lot of information about the fragments and activities, and still I can not find an usable for me solution. I need to pass several objects when initializing the Fragment, which doesn't seem to be possible using the newInstance() method. Plus for using this method I would need to make serializable all of the VO which we are using (complex). Plus I would still need to pass objects (again complex VO) from the fragment back to the activity... is there any way to pass those big objects? Could an interface work for passing information in both ways?
I would really appreciate any help (some tutorial would be awesome), because I couldn't find any solution for this problem, and I am very stacked in here.
Thanks in advance!