このようにそのファイルのパスを指定する必要があります。
String extStorageDirectory = Environment.getExternalStorageDirectory()
.toString() + "/folder_name";
File directory = new File(extStorageDirectory);
File fileInDirectory = new File(directory,file_name.html);
//Read text from file
StringBuilder html_text = new StringBuilder();
try {
BufferedReader br = new BufferedReader(new FileReader(fileInDirectory));
String line;
while ((line = br.readLine()) != null) {
html_text.append(line);
html_text.append('\n');
}
}
catch (IOException e) {
//You'll need to add proper error handling here
}
次に、このhtmlコードを編集に使用します
String message ="<font color='white'>"+"<u>"+"text in white"+ "<br>" +"<font color='cyan'>"+"<font size='2'>"+" text in blue color "+"</font>";
webview.loadData(message, "text/html", "utf8");