R.color.red is an identifier, not the color itself. You need to call getResources().getColor(R.color.red)
On Thu, Jul 23, 2009 at 9:28 PM, atharva chauthaiwale<[email protected]> wrote: > Hi, I dont hv any idea abt this problem. However, but u can try doing it by > another way. > > 1.import android.graphics.Color > 2. myRadioButton.setTextColor(Color.RED); > > I hope it will work :) > > > On Wed, Jul 22, 2009 at 10:53 PM, niko001 > <[email protected]> wrote: >> >> Hi, >> >> I am trying to change the text color of a RadioButton (which is >> defined in an xml layout and is in a RadioGroup) during the runtime of >> my app. >> >> When I change the text color directly in the Eclipse Android Layout >> Editor by setting the TextColor property to "@color/red" (which I >> defined in strings.xml), it works just fine, but when I try to do this >> programmatically during runtime via >> >> myRadioButton.setTextColor(R.color.red); >> >> it only turns the color to grey, not to red as intended. >> >> R.color.red (@color/red) is correctly defined as a hex value >> ("#FF0000"), and as I said it does turn the text color to red in the >> layout editor, but not via a Java command. >> >> Thank you for your help, >> Niko >> >> > > > > > -- Romain Guy Android framework engineer [email protected] Note: please don't send private questions to me, as I don't have time to provide private support. All such questions should be posted on public forums, where I and others can see and answer them --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Beginners" 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-beginners?hl=en -~----------~----~----~----~------~----~------~--~---

