Отображение base64 pdf в webview на android
Hi guys I have to view a pdf in base64 in a WebView to do so I used the code below but it does not work! How can I visualize it? I tried this solution but it does not seem to work, nothing is shown in the WebView! What can it be?
Что я уже пробовал:
<pre lang="java"> @Override public void onViewCreated(View view, Bundle savedInstanceState) { super.onCreate(savedInstanceState); final Button btnGeneraRapportino = (Button)view.findViewById(R.id.buttongenera_rapportino); final WebView img= (WebView) view.findViewById(R.id.WebView_Rapportino); btnGeneraRapportino.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { Rapportino r = new Rapportino(); String ImageBase64 = r.GeneraRapportinoPrivato("prova"); //This method return String with Image into Base64 try { String urlString = getActivity().getIntent().getStringExtra(ImageBase64); String mimeType = getActivity().getIntent().getStringExtra("MimeType"); WebSettings settings = img.getSettings(); settings.setDefaultTextEncodingName("utf-8"); String base64 = Base64.encodeToString(urlString.getBytes(), Base64.DEFAULT); img.loadData(urlString, "text/html; charset=utf-8", "base64"); } catch (Exception ex){ System.out.print("Errore: "+ex); } } }); }