I currently created an app for android.
In this app I successfully display an XLS file, thanks to the google doc viewer and passing the file the URL like this:
WebView mWebView=new WebView(MyActivity.this);
mWebView.getSettings().setJavaScriptEnabled(true);
mWebView.getSettings().setPluginsEnabled(true);
mWebView.loadUrl("https://docs.google.com/gview?embedded=true&url="+LinkTo);
setContentView(mWebView);
So, now I need to display the same XLS file which I saved into my device storage, not from an URL this time, but directly from the storage.
I found lots of advices to make it with a link to the file in the URL, but not with my file already onto my device.
So, before I start, I'd like to know if it is possible?
I saw this method myWebView.loadData( );
Can I use it for my problem?
Can I use docs.google.com/gview with an internal file?
EDIT
I try the solution of Der Gol...lum
This is my code :
WebView wv = (WebView)findViewById(R.id.fileWebView);
wv.getSettings().setJavaScriptEnabled(true);
String root = Environment.getExternalStorageDirectory().toString();
String my_path = root + "/excel_files/";
wv.loadUrl("file://" + my_path + excelFile.getName());
wv.setWebViewClient(new WebViewClient() {
public boolean shouldOverrideUrlLoading(WebView view, String url) {
view.loadUrl(url);
return false;
}
});
But the webview display a blank page