My code is:
public static void ToastMemoryShort (Context context) {
CharSequence text = getString(R.string.toast_memoryshort); //error here
Toast.makeText(context, text, Toast.LENGTH_LONG).show();
return;
}
but I'm getting "Cannot make a static reference to the non-static method getString(int) from the type Context" in Eclipse. I'm trying to get ready for localising my app (getting all the hard coded strings into resources), so where I have:
getString(R.string.toast_memoryshort)
I previously had a hard coded string which was fine.
I'm not sure what's going on here (Java noob). Can anyone enlighten me please?
Many thanks
Baz
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…