radiogroup + radio buttons

16 views
Skip to first unread message

Johnny TwoShoes

unread,
Mar 13, 2016, 4:17:17 PM3/13/16
to RoboBinding
Hi,

I have a radio group with radio buttons (3). I bind to a class, but, if on creation , if I leave out the radio buttons (since, I don't want a default value, rather the user must select one) , radiobinding doesn't work correctly ( I can't remember the side affects). the xml for the radio button is:
android:text="Yes"
bind:checked="{checked1}"

android:text="No"
bind:checked="{checked2}"

android:text="NA"
bind:checked="{checked3}"

and in the viewmodel:
    private Boolean checked1;
    private Boolean checked2;
    private Boolean checked3;
    private String sel;

Depending on whether  sel = Yes/No/NA, one of the three checkboxes is selected; on initialization. If I leave sel blank, it seems to corrupt the binding???

Any ideas most appreciated.

kind regards







cheng

unread,
Mar 13, 2016, 7:02:04 PM3/13/16
to RoboBinding
Hi Johnny,

You are right. At the moment, preinitializingViews flag control whether to preinitialize views, but it is on PresentationModel level. So please use android standard way instead in this case.


You can rise an issue to RoboBinding if you wish to. Once the two are implemented, you will have something like below:

@PresentationModel
class PresentationModel {
  @SubPresentationModel(preInitializingViews=false)
  public RadioGroupPM getRadioGroupPM() {
    return radioGroupPM;
  }
}

@PresentationModel
class RadioGroupPM {
  public boolean get/setRadio1(...){}
  ...
  public boolean get/setRadioN(...){}

Cheers,
Cheng Wei

在 2016年3月14日星期一 UTC+11上午7:17:17,Johnny TwoShoes写道:

Johnny TwoShoes

unread,
Mar 14, 2016, 7:26:59 AM3/14/16
to RoboBinding
ok, thanks

robobinding android

unread,
Apr 7, 2016, 7:41:22 AM4/7/16
to robob...@googlegroups.com

Hi Johnny,

Correct. Robobinding does not support parts of VM without Pre-initializing at the moment. Seems we discussed this somewhere before. Unless whole VM without Pre-initializing, views will be initialized with values from VMS. The choice at the moment is to implement those special parts in standard Android way.

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.

robobinding android

unread,
Apr 7, 2016, 7:43:18 AM4/7/16
to robob...@googlegroups.com

Sorry, ignore this please. Duplicated reply.

Reply all
Reply to author
Forward
0 new messages