// file_name = "07092022114344-java_tutorial.pdf";
file_name = "07092022114344-1662530603380.jpg";
dialog_attach_expense_info = new Dialog(MainActivity.this);
binding.expenseAttach.setText(file_name);
binding.expenseAttach.setOnClickListener(v -> {
openDialogShowDownloadImagePDF();
});
the above code is basically in the onCreate method of the main activity
private void openDialogShowDownloadImagePDF() {
dialogBinding = DialogImagePdfBinding.inflate(getLayoutInflater());
dialog_attach_expense_info.setContentView(dialogBinding.getRoot());
dialog_attach_expense_info.getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
dialog_attach_expense_info.setCancelable(false);
dialog_attach_expense_info.getWindow().getAttributes().windowAnimations = R.style.animation;
// set background transparent
dialog_attach_expense_info.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
//TODO: image view code to view image from url (PDF/Image)
dialogBinding.webView.setWebViewClient(new WebViewClient());
dialogBinding.webView.getSettings().setJavaScriptEnabled(true);
// dialogBinding.webView.loadUrl("url" + file_name);
dialogBinding.webView.loadUrl("url" + file_name);
dialogBinding.btnCloseDialog.setOnClickListener(v -> {
dialog_attach_expense_info.dismiss();
});
dialogBinding.btnDownloadDialog.setOnClickListener(v -> {
//TODO: download event
});
dialog_attach_expense_info.show();
}
Here in the above the URL is working well in chrome. But the URL that consists of .pdf is not showing up in the webview any ideas where this code lacks