veera ravala
- Forum posts: 1
Oct 15, 2022, 8:33:51 AM via Website
Oct 15, 2022 8:33:51 AM via Website
My webview is loading google chrome. When the user browses the webview app he can navigate to any links which is working fine. But when the user navigates to a link which contains pdf my webview fails to open or download the file. How can I achieve it?
public class WebViewPage extends AppCompatActivity {
WebView webView;
Button closeweb;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_web_view_page);
webView =findViewById(R.id.webview);
closeweb = findViewById(R.id.closeweb);
WebSettings webSettings = webView.getSettings();
webSettings.setJavaScriptEnabled(true);
webView.setWebViewClient(new WebViewClient());
webView.loadUrl("any url");
closeweb.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(WebViewPage.this, HomePage.class);
startActivity(intent);
}
});
}
@Override
public void onBackPressed() {
}
}
Recommended editorial content
With your consent, external content is loaded here.
By clicking on the button above, you agree that external content may be displayed to you. Personal data may be transmitted to third-party providers in the process. You can find more information about this in our Privacy Policy.