1
이 질문에 대한 여러 스레드를 보았지만 왜 저들이 저를 위해 일하지 않는지 모르겠습니다. 여기에 짧은 코드 :이름으로 문자열 리소스 가져 오기
//This doesn't work. I'm getting a 0 id
id=getResources().getIdentifier("q1", "id", getPackageName());
//This retrieves the string correctly (just to prove the string is called q1
String str=getResources().getString(R.string.q1);
내가 생각할 수있는 유일한 점은 패키지 이름에 문제가 있지만 괜찮은 것 같습니다.
어떤 도움이 필요합니까?