Getting Resources from SherlockFragment

I am trying to get a color from colors.xml, using something along the lines of

view.setBackgroundColor(getResources().getColor(R.color.bgcolor_view));

Although there is a R.color.bgcolor_view in my colors.xml file, the R.color part only shows colors that are available in the built-in android settings. So I'm assuming that getResources() is not getting the resources from my project.

So, my question is, how do I obtain resources from within a SherlockFragment?

Answers


Look at your imports, you probably imported android.R, so remove this import and double check that you import your own R from your own project.


Need Your Help

Iterate over model attributes and check error messages

ruby-on-rails ruby rspec attributes bdd

I am trying to iterate over an object and change its attributes while testing with rspec. The idea is to test that the strings are not too long (max 255 chars). Since there are so many, I want to a...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.