I can't seem to find a good answer here or elsewhere for this, so here goes. I created a Master/Detail android application, so there are two packages is src
:
com.example.app
ItemDetailActivity.java
ItemDetailFragment.java
ItemListActivity.java
ItemListFragment.java
com.example.app.content
ItemContent.java
Now, what I want to do is add a formatted string from a resource in src/res/values/string.xml
to the ItemContent.java
file. The strings.xml
file already contains the contact_information string. When I use this line:
public CharSequence contact_information = getResources().getText(R.string.contact_information);
I get the Eclipse error that The method getResources() is undefined for the type ItemContent
. When I use the same line in say, ItemDetailFragment.java
it's fine. What am I missing in the content package to allow me to reference the string?