Read HTML file from assets

android

Solution

InputStream is = getAssets().open("aaa.html");
int size = is.available();

byte[] buffer = new byte[size];
is.read(buffer);
is.close();

String str = new String(buffer);
str = str.replace("old string", "new string");

Problem

I have an html file in assets, aaa.html. I want to read the contents of html file and replace it from another string. Is this way is right or is there any other option. my code: ``` File f = new File("file:///android_asset/aaa.html"); FileReader fr = new FileReader(f); BufferedReader br = new BufferedReader(fr); ``` But its giving file not found, where as loading in web view loads the file.

Original source