It seems like the problem is that you cannot change a RadioButton's
text from the onCreate method if it has already been set, or something
like that. Anyway, there's a bug report with a project that
demonstrates the problem here:
http://code.google.com/p/android/issues/detail?id=8039&q=radiobutton&colspec=ID%20Type%20Status%20Owner%20Summary%20Stars

It turns out that I had to set the RadioButton text from the onResume
event instead of onCreate, although I'm pretty sure it should have
just worked automatically based on the resources.

On Apr 29, 3:30 pm, Mark Murphy <[email protected]> wrote:
> Mike Olson wrote:
> > Mark Murphy wrote:
> >> That's pretty odd. I am not aware of any particular problems here. In
> >> fact, I just hacked in res/values-land/strings.xml in one of my book
> >> samples, and it works as expected.
>
> > I think I figured it out. The actual strings are being used as the
> > text property of RadioButtons in a RadioGroup. I made a simple
> > activity with the following setup:
>
> > layout/main.xml:
> > <?xml version="1.0" encoding="utf-8"?>
> > <LinearLayout xmlns:android="http://schemas.android.com/apk/res/
> > android"
> >     android:orientation="vertical"
> >     android:layout_width="fill_parent"
> >     android:layout_height="fill_parent"
>
> >     <RadioGroup
> >            android:id="@+id/rg_parts"
> >            android:orientation="horizontal"
> >            android:layout_width="fill_parent"
> >            android:layout_height="45dip"
>
> >            <RadioButton
> >                    android:id="@+id/btn_tenor"
> >            android:layout_height="wrap_content"
> >            android:layout_width="fill_parent"
> >            android:layout_weight="1"
> >            android:text="@string/hello"
> >            android:tag="1"
> >            />
> >     </RadioGroup>
> > </LinearLayout>
>
> > res/values/strings.xml:
> > <?xml version="1.0" encoding="utf-8"?>
> > <resources>
> >     <string name="hello">Hello World, Portrait!</string>
> >     <string name="app_name">OrientationTest</string>
> > </resources>
>
> > res/values-land/strings.xml:
> > <?xml version="1.0" encoding="utf-8"?>
> > <resources>
> >     <string name="hello">Hello World, Landscape!</string>
> > </resources>
>
> > In this case, changing the orientation does not update the string on
> > the RadioButton. Maybe this is a bug with RadioButton or RadioGroup? I
> > don't know, but I guess for now I'll just set all the values manually.
>
> Off the cuff, that sure looks good. If you think of it, upload your
> sample project as an issue onhttp://b.android.com.
>
> --
> Mark Murphy (a Commons 
> Guy)http://commonsware.com|http://twitter.com/commonsguy
>
> _The Busy Coder's Guide to *Advanced* Android Development_
> Version 1.5 Available!
>
> --
> 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 
> athttp://groups.google.com/group/android-developers?hl=en

-- 
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

Reply via email to