import android.app.DownloadManager;
import android.app.ProgressDialog;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.os.Environment;
import android.renderscript.Sampler;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.text.Html;
import android.view.ViewGroup;
import android.webkit.DownloadListener;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import com.amazonaws.Request;
import javax.security.auth.callback.Callback;
public class WebViewActivity extends AppCompatActivity {
String url;
WebView webView;
ProgressDialog progressBar;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.webview_pdf);
url = getIntent().getStringExtra("url");
webView = findViewById(R.id.webViewpdf);
WebSettings webSettings = webView.getSettings();
webSettings.setJavaScriptEnabled(true);
progressBar=ProgressDialog.show(this,"","loading");
//"https://docs.google.com/gview?embedded=true&url=" this is the online google viewer
webView.loadUrl("https://docs.google.com/gview?embedded=true&url=" + url);
webView.setWebViewClient(new WebViewClient() {
// this is used for showing the progress until the page stops loading
public void onPageFinished(WebView view, String url) {
if (progressBar.isShowing()) {
progressBar.dismiss();
}
}
});
}
}
No comments:
Post a Comment