Did you try this RadioGroup rg = (RadioGroup)findViewById(R.id.radio_group_prefs);
On Mar 1, 6:47 pm, mjk <[email protected]> wrote: > So... turns out I was lying horribly. ;P The line that instantiates > prefView reads as such: > > RadioGroup prefView = (RadioGroup) sharingPrefs.getView(new > RadioGroup(this), null); > > So it looks like I was getting a new, completely unrelated > RadioGroup. Does anyone know how I can get access to the actual > RadioGroup that's being rendered? > > Thanks, > Myung > > On Mar 1, 4:52 pm, mjk <[email protected]> wrote: > > > Hello all, > > > I'm trying to make a somewhat advanced settings Activity (one that has > > a RadioGroup in one of the cells). The layout xml file contains the > > following: > > > <?xml version="1.0" encoding="utf-8"?> > > > <PreferenceScreen > > xmlns:android="http://schemas.android.com/apk/res/android" > > > <PreferenceCategory android:title="Email"> > > > <EditTextPreference > > android:name="changeEmail" > > android:summary="Click to Change Email" > > android:persistent ="false" > > android:title="Click to Change Email" > > android:key="editTextPref" /> > > </PreferenceCategory> > > > <PreferenceCategory android:title="Location Sharing"> > > <Preference > > android:title="placeholder" > > android:summary="summary text" > > android:layout_width="fill_parent" > > android:layout_height="wrap_content" > > android:key="sharingPrefs" > > android:layout="@+id/radio_group_prefs" > > /> > > > </PreferenceCategory> > > ... > > > Another layout xml file (radio_group_preferences.xml) contains the > > following: > > > <?xml version="1.0" encoding="utf-8"?> > > <RadioGroup > > xmlns:android="http://schemas.android.com/apk/res/android" > > android:id="@+id/radio_group_prefs" > > android:layout_width="fill_parent" > > android:layout_height="wrap_content" > > android:orientation="vertical"> > > > <RadioButton > > android:checked="false" > > id="@+id/option1" > > android:text="radio_group_1_option1" > > /> > > > <RadioButton > > android:checked="false" > > android:text="radio_group_1_option2" > > id="@+id/option2" /> > > > <RadioButton > > android:checked="false" > > android:text="radio_group_1_option3" > > id="@+id/option3" /> > > > </RadioGroup> > > > In my settings activity java class, I have the following: > > > protected void onCreate(Bundle savedInstanceState) { > > super.onCreate(savedInstanceState); > > addPreferencesFromResource(R.layout.settings); > > > //email textfield setup omitted > > > Preference sharingPrefs = > > (Preference)findPreference("sharingPrefs"); > > RadioGroup prefView = (RadioGroup) > > sharingPrefs.getView(null, > > null); > > prefView.setOnCheckedChangeListener(radioListener); > > > } > > > And the RadioGroup listener is defined as such: > > > RadioGroup.OnCheckedChangeListener radioListener = new > > OnCheckedChangeListener() { > > > @Override > > public void onCheckedChanged(RadioGroup group, int > > checkedId) { > > Log.v(TAG, "Radio check changed, checkedId = > > "+checkedId); > > } > > }; > > > Now here's the weird part. It runs and renders correctly. However, > > when I shift around the radio button, I don't get the log messages. > > Going through the debugger, I could see that the RadioGroup's > > onCheckedChangedListener was getting set correctly (at least, it was > > null before the call to setOnCheckedChangeListener and it wasn't null > > afterward). How can this be? It seems like the calls to > > onCheckedChanged are somehow being suppressed. Is this a legitimate > > bug? > > > Thanks, > > Myung -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

