java - android RadioButton text is not updated when RadioButton is selected in RadioGroup, and Fragment is recreated from backstack -


I have a radiogram where I programmatically add the radioboots. All this is done in the onCreateView () method, so each time the piece should be rebuilt from backstack. The problem I have is when I program RadioGroup.check (ID) , RadioButton is no longer in the form of updates about the upcoming call onCreateView () using the method By initially in the radiobutton preselect

This code is:

  public fixed string x; // (X changes every time) @Override Public View onCreateView (LayoutInflater inflater, ViewGroup container, savedInstanceState bundle) {see rootView = nflater.inflate (R.layout.right, container, false); Radio group RG = (radio group) Routview.findvbiid (RID.Ready Group 1); Rg.removeAllViews (); Log.d ("Cild count", Integer.toString (rg.getChildCount ()); // always works with RadioButton.rb = New RadioButton (getActivity ()); // always works first time with 1 and 2 Rb.setText (x); rb.setId (99099); // for the id rg.addView (RB); 1 atbitrary integer; rg.check (99099); // 2. Radiovutton return was selected by rootView;}  

The problem was not resolved by using a backstack But instead of dealing with it manually. OnBackPressed

  piece fr = getSupportFragmentManager () getFr AgitByTag ("piece name"); .. @Override Public Zero onBackPressed () {if (! Fr = null) {getSupportFragmentManager () startTransaction () (container, new back, "tag"). Commit ();} Other { Super. Backpress ();}}  

Comments

Popular posts from this blog

winforms - C# Form - Property Change -

java - Messages from .properties file do not display UTF-8 characters -

javascript - amcharts makechart not working -