루트 폴더에 파일이 저장되어 있으며 웹보기에서 열려고합니다.Webview에서 로컬 HTML 파일 열기 - Android
OutputStream outstream = null;
outstream = openFileOutput(fileName ,MODE_WORLD_READABLE);
/// if file the available for writing
if (outstream != null) {
/// prepare the file for writing
OutputStreamWriter outputreader = new OutputStreamWriter(outstream);
BufferedWriter buffwriter = new BufferedWriter(outputreader);
/// write the result into the file
buffwriter.write(result);
}
/// close the file
outstream.close();
} catch (java.io.FileNotFoundException e) {
System.out.println("File not found in the writing...");
} catch (IOException e) {
System.out.println("In the writing...");
}
이 파일을 불러올 내 코드입니다 :
fileView.getSettings().setJavaScriptEnabled(true);
fileView.loadUrl("file:///" + name); <---
는 앱 내부가 나에게 오류를 발견하지 않는 파일을 제공
이 절약 내 코드입니다.
어떤 통찰력이 도움이됩니다.
처럼 작성해야합니다, 당신은 test.html를 파일에 액세스 할 수 있다고 가정합니다. 이론 상으로는 html5 캔버스와 자바 스크립트 게임을 만들고 안드로이드 폰에 로컬로 파일을 저장 한 다음 플레이어가 게임을 할 수 있도록 webview로 열 수 있습니까? – Jacob