0
HTMLファイルがユーザーに表示される前に、置き換えたいキーワードがいくつかあります。私はいくつかの検索を行い、いくつかの方法を試しましたが、私はそれを動作させることができません。WebViewのHTMLファイルでの検索と置き換え
は、ここに私の現在の実装です:私はすべてのエラーを取得していないよ
web_subscribe = (WebView) findViewById(R.id.web_subscribe);
try {
InputStream is = getAssets().open("subscribe.html");
int size = 0;
size = is.available();
byte[] buffer = new byte[size];
is.read(buffer);
is.close();
String str = new String(buffer);
str.replace("first_name",Globals.forename);
str.replace("last_name", Globals.surname);
str.replace("input_email", Globals.email);
try {
Context context = getApplicationContext();
OutputStreamWriter outputStreamWriter = new OutputStreamWriter(context.openFileOutput("subscribe.html", Context.MODE_PRIVATE));
outputStreamWriter.write(str);
outputStreamWriter.close();
}
catch (IOException e) {
e.printStackTrace();
}
} catch (IOException e) {
e.printStackTrace();
}
web_subscribe.loadUrl("file:///data/data/uk.co.livingayurveda.vpkquestionaire/files/subscribe.html");
、およびWebViewが置き換えられたタグなしを除いて正常に表示されます。だから私はちょうど正しいパスからURLを読み込んでいないと思いますか?