I have to show different type of documents from a remote URL link in my application. I have use Google Doc in a webview like this
private WebView mWvHome = (WebView) view.findViewById(R.id.wv_home);
mWvHome.setWebChromeClient(new WebChromeClient() {
public void onProgressChanged(WebView view, int progress) {
}
});
mWvHome.setWebViewClient(new WebViewClient() {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
view.loadUrl(url);
return false;
}
@Override
public void onReceivedSslError(WebView view, final SslErrorHandler handler, SslError error) {
}
});
mWvHome.getSettings().setJavaScriptEnabled(true); // enable javascript
//Pasting a Fixed URL link to the file I am getting this Error.
mWvHome.loadUrl("http://docs.google.com/gview?embedded=true&url=http://followitdc.cloudapp.net/FollowitMediaAPIv4/images/bb629006-d930-4fbe-b9ec-91895dc5133c.docx");
Here is my Layout file
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white">
<ProgressBar
android:id="@+id/progress"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="match_parent"
android:layout_height="@dimen/margin_normal"
android:layout_alignParentTop="true"
android:max="100"
android:progress="0"
android:progressDrawable="@drawable/custom_progressbar"
android:visibility="visible" />
<WebView
android:id="@+id/wv_home"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@id/progress" />
<RelativeLayout
android:id="@+id/rl_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@id/progress"
android:background="@color/white">
<ProgressBar
style="?android:attr/progressBarStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true" />
</RelativeLayout>
</RelativeLayout>
After loading getting this response from google doc.
File of size less than 2MB in .docx format are loading some file less than 2MB are also not loading. What it the issue? Is it file size issue or Error in file. Because file is working properly in Google Doc online Editor and also on Microsoft Word. Any help will be appreciated.