vendredi 27 janvier 2017

In viewpager, checkbox state loss on swipe. what is logic behind this scenario

I have viewpager which has multiple fragments.

 <LinearLayout xmlns:android="http://ift.tt/nIICcg"

android:layout_width="match_parent"
android:layout_height="match_parent">
 <CheckBox android:layout_width="match_parent"
           android:layout_height="match_parent"
           android:text="Do you need recurring" />
  <RadioGroup android:id="@+id/rdgrpEnd"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_margin="@dimen/most_most_most_min_margin"
              android:gravity="left|start"
              android:orientation="vertical">

                        <RadioButton
                            android:id="@+id/rdbtnNever"
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:layout_weight="0.3"
                            android:padding="@dimen/min_margin"
                            android:text="Never " />

                        <RadioButton
                            android:id="@+id/rdbtnAfter"
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:layout_weight="0.3"
                            android:padding="@dimen/min_margin"
                            android:text="After" />
                        <RadioButton
                            android:id="@+id/rdbtnOn"
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:layout_weight="0.3"
                            android:padding="@dimen/min_margin"
                            android:text="After" />
    </RadioGroup>

 </LinearLayout>

with this i got no error on this. My doubt is, My viewpager has 15 fragments and which doesn't have setOffscreenPageLimit() function. I I checked both check box and radio button. I swiped to last fragment. ex: 15th fragment.now i am back to first fragment which i checked on before swipe to 15th fragment. Here, CheckBox lost it's state.(Here unchecked) but radio button has it's state(Here checked state) .what is the logic behind this.




Aucun commentaire:

Enregistrer un commentaire