I am trying to display multiple pdf files in ViewPager
using web view.
I am able to fetch the path of pdf files in onActivityResult
. But path is showing
/content:/com.android.providers.downloads.documents/document/8828
. web view is not loading . I tried by hardcoding value Here is my code :
val intent = Intent(Intent.ACTION_OPEN_DOCUMENT)
intent.addCategory(Intent.CATEGORY_OPENABLE);
intent.setType("application/pdf");
intent.action = Intent.ACTION_GET_CONTENT
intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE,true)
startActivityForResult(intent, PDF_EXPLORER_REQUEST_CODE)
and in onActivityResult
val mImageUri = data.data.path
webview.loadUrl(mImageUri.toString())
I tries by getting actual path of pdf in phone webview.loadUrl(/storage/emulated/0/Download/dummy.pdf)
if I hardcode some url like htts://www.goole.com
webview is loading. But not loading my local pdfs.
how to do this?