one to many relationship

9 views
Skip to first unread message

Johnny TwoShoes

unread,
Apr 5, 2016, 2:58:32 PM4/5/16
to RoboBinding
I have a one-many relationship,so in my ViewModel, I have
private List<ActivityViewModel> activityViewModels;
and a ActivityViewModel has:
private Activity activity;
when I traverse ViewModel, how can I get it to display the correct activity???


wei cheng

unread,
Apr 5, 2016, 7:25:23 PM4/5/16
to robob...@googlegroups.com
Hi Johnny,

It is a bit strange that you have ViewModel holding an activity, which looks against the intention of Presentation Model(or MVVM) pattern. Could you please provide more information on the case? or is it possible to make a simplest sample out of it and i will have a quick look to see if there is a potential design mistake?

Cheers, Cheng

--
You received this message because you are subscribed to the Google Groups "RoboBinding" group.
To unsubscribe from this group and stop receiving emails from it, send an email to robobinding...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Johnny TwoShoes

unread,
Apr 6, 2016, 5:00:07 AM4/6/16
to RoboBinding
Hi Cheng,

Thanks for the quick response. 
1. the Activity is a Model ( realm object ). It represents a text and 4 dropdown list selections. Since I can have multiple activities, I have one main fragment that isn't bound to anything, that has multiple fragments, each bound to a ActivityVM. 
2. I will try to make simple project representing the issue. 

thanks

wei cheng

unread,
Apr 6, 2016, 6:16:21 AM4/6/16
to robob...@googlegroups.com
Hi Johnny,

Got you. I thought it was android Activity. 

Cheers, Cheng

Johnny TwoShoes

unread,
Apr 6, 2016, 1:36:38 PM4/6/16
to RoboBinding
Hi,

Sorry, it's a poorly named Model. 
Reply all
Reply to author
Forward
0 new messages