I have to create we application in android.
So what i done is that,simply created raw folder under res and put html files there.
All works fine but when i click a button that is put inside that web page nothing happens and the click event not get work.
Here are my codes.
newfile.html
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<form>
<input type="button" value="Click me" onclick="openDialog()">
<script>
function openDialog()
{
alert("ok");
}
</script>
</form>
</body>
</html>
and this is my java code,
webview.loadData(readTextFromResource(R.raw.newfile),"text/html", "utf-8");
readTextFromResource function
private String readTextFromResource(int resourceID)
{
InputStream raw = getResources().openRawResource(resourceID);
ByteArrayOutputStream stream = new ByteArrayOutputStream();
int i;
try
{
i = raw.read();
while (i != -1)
{
stream.write(i);
i = raw.read();
}
raw.close();
}
catch (IOException e)
{
e.printStackTrace();
}
return stream.toString();
}
Please some one point me why the click event not working !