res/values에서 문자열로 파일 이름을 참조하여 에셋에있는 xml 파일을 구문 분석 할 수 있습니까?문자열로 참조되는 Android parse xml
Document doc = db.parse(assetManager.open("questions.xml"));
및 questions.xml 대신 @ string/questions.xml이 필요합니까? 이 문제를 해결하는 데 어려움을 겪고 있습니다.
res/values에서 문자열로 파일 이름을 참조하여 에셋에있는 xml 파일을 구문 분석 할 수 있습니까?문자열로 참조되는 Android parse xml
Document doc = db.parse(assetManager.open("questions.xml"));
및 questions.xml 대신 @ string/questions.xml이 필요합니까? 이 문제를 해결하는 데 어려움을 겪고 있습니다.
당신이 코드로 작업을 수행 할 수 있습니다
Document doc = db.parse(assetManager.open(getApplicationContext().getResources().getString(R.string.questions));
희망하는 데 도움이 :
Resources res = getApplicationContext().getResources();
String filename = res.getString(R.string.questions);
Document doc = db.parse(assetManager.open(filename));
또는 하나 개의 간단한 라인
.
[XML 데이터 구문 분석] (http://developer.android.com/training/basics/network-ops/xml.html) – chridam
왜 그럴 수 있습니까? 질문 목록이 있으면 사용하십시오. http://developer.android.com/guide/topics/resources/string-resource.html#StringArray – Ascension
정말 가능한지 알고 싶습니다. – WiseGuy