Issue
I am trying to write a very simple code to save a web page to disk in a web archive in Android 4.0.3 ICS. My code is:
final WebView myWebView = (WebView) findViewById(R.id.myWebView);
myWebView.setWebViewClient(new myWebClient());
myWebView.getSettings().setJavaScriptEnabled(true);
myWebView.loadUrl("https://academics.vit.ac.in/student/stud_login.asp");
Button forward = (Button) findViewById(R.id.bForward);
Button back = (Button) findViewById(R.id.bBack);
Button update = (Button) findViewById(R.id.bUpdate);
forward.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (myWebView.canGoForward())
myWebView.goForward();
}
});
back.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (myWebView.canGoBack())
myWebView.goBack();
}
});
update.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
myWebView.saveWebArchive("theArch");
}
});
The thing is, the webview is working perfectly but whenever I am clicking the Update button, what I get is (from LogCat):
03-26 18:41:38.797: D/webcoreglue(755): saveWebArchive: Failed to initialize xml writer.
and nothing else happens whatsoever.....
Please can anyone help me out on this; as this is a component of something else very important....
Thanks in advance!!!!
Solution
Try providing a fully qualified path, not "theArch"
. Use getFilesDir()
and the File
constructor to provide a path to internal storage, for example.
Answered By - CommonsWare
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.