Using string from resource XML in Switch?
问题 New to Android here, so I apologize if this is a simplistic question. I am attempting to use a switch based on string resources in my XML. It would look something like this: switch (myStringVariable) { case getResources().getString(R.string.first_string): break; case getResources().getString(R.string.second_string): break; case getResources().getString(R.string.third_string): break; default: break; } Unfortunately, this won't work. The error that I get is "Constant expression required". Is