これが私のres/values-es/strings.xml
ファイルの文字列です:
<string name="jcq1">Text text text textttttttttt</string>
Javaコードで使用する場所は次のとおりです。
jc.add(new Question("42", "21", "33", "29", 0, getResources().getString(R.string.jcq1), -1));
それは私にこのエラーを与えています:
The method getResources() is undefined for the type Quiz
WhereQuiz
は、Java コードが存在するクラスの名前です。メソッドの他のすべてのサンプルコードは、getResources()
問題なく同じ方法で使用しているようです。私の実装が機能していないのは何ですか?
編集
public class Quiz {
public Quiz(Context c) {
jc.add(new Question("42", "21", "33", "29", 0, c.getResources().getString(R.string.jcq1), -1));
// 300 other lines pretty much identical to the one above follows...