0

I am trying to load the .pdf file in the webview, but it shows below popup

enter image description here

How to cancel this popup in Android webview. Please help

Anbu
  • 671
  • 1
  • 6
  • 18
  • I think WebView doesn't support showing a pdf file. You can use some lib for that, something line (com.github.barteksc:android-pdf-viewer) – Demigod Apr 28 '20 at 14:36
  • @Demigod you are right i am using the same, but When i go back from com.github.barteksc:android-pdf-viewer the shown popup is visible . donot know how to cancel the above shown dialog – Anbu Apr 28 '20 at 14:41
  • Share more info about your implementation. It looks like your opening pdf viewer from a web view and not overriding an opening of pdf URL which opens this dialog... – Demigod Apr 28 '20 at 20:06
  • @Demigod Please find the implementation below ```override fun shouldOverrideUrlLoading( view: WebView?, url: String ): Boolean { Log.e("pdf Page = ", url!!) val regIntent = Intent(this@LoginWebViewActivity, PdfViewActivity::class.java) regIntent.putExtra("pdfurl", url) regIntent.putExtra("ViewType", "internet") startActivity(regIntent) return true } return true }``` – Anbu Apr 29 '20 at 01:39
  • The reason might be that there are two different `shouldOverrideUrlLoading` callbacks (with URL as String and with web resource request). Check if you override both. – Demigod Apr 29 '20 at 08:00

1 Answers1

0

Have you tried the ACTION_CLOSE_SYSTEM_DIALOGS?

This is broadcast when a user action should request a temporary system dialog to dismiss. Some examples of temporary system dialogs are the notification window-shade and the recent tasks dialog.

Example of using:

Intent it = new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS);
context.sendBroadcast(it);

I'm not sure if it works for that dialog.

Raluca
  • 41
  • 5