Android Eclipse에 프로젝트가 있으며 Android 에뮬레이터에서 실행됩니다. 내 프로젝트에서는 translations 폴더에 xlf ( xml 형식 ) 파일을 넣었습니다 . 그리고 나는 그것들을 읽고 파싱 할 것입니다. 그러나 나는 항상 실패하는 것 같습니다. 내 프로젝트의 구조는 첨부 이미지와 같습니다.
그리고 TC01_OSNdemo.java는 내 기본 패키지입니다. 여기에 " translations "폴더 에서 xml 파일을 구문 분석하는 코드를 작성했습니다 . 그러나 절대 경로, 상대 경로 등에 상관없이 실패한 것 같습니다.
내 방법 1 : 상대 경로
String FileName = "./translations/myosn.mofile.android.zn_CN.xlf"
File tfile = new File(FileName);
if (tfile.exists())
{
System.out.println("zhaotest File exist");
}
else
{
System.out.println("zhaotest File Not Exist");
}
파일을 찾을 수없는 것 같습니다
내 방법 2. 내 프로젝트의 절대 경로.
String FileName = "C:\\Users\\****\\workspaceforandroid\\OSNdemo\\translations\\myosn.mofile.android.zn_CN.xlf";
파일을 찾을 수없는 것 같습니다.
내 방법 3.
String FileName = Environment.getExternalStorageDirectory()+ File.separator+ "OSNdemo" +File.separator + "translations"+File.separator + "myosn.mofile.android.zn_CN.xlf";
파일을 찾을 수없는 것 같습니다. :(
누구든지이 문제에 대해 나를 도울 수 있습니까?
감사합니다!
assets/
You can use it to store raw asset files. Files that you save here are compiled into
an .apk file as-is, and the original filename is preserved. You can navigate this directory in the
same way as a typical file system using URIs and read files as a stream of bytes using the
AssetManager. For example, this is a good location for textures and game data.
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다