Note that there are some explanatory texts on larger screens.

plurals
  1. POunable to load html with img src from server to webview
    primarykey
    data
    text
    <p>I am designing a quiz app where questions and answers come from server. All the questions and answers are in html format with img src tag as well for images(Images in JPG format). i am using webviews for questions and options. I am using below code to load html content </p> <pre><code> addquestion.removeAllViews(); lvoption1.removeAllViews(); lvoption2.removeAllViews(); lvoption3.removeAllViews(); lvoption4.removeAllViews(); weboption1 = new WebView(ExamStart.this); weboption1.setWebViewClient(new WebViewClient()); weboption1.getSettings().setJavaScriptEnabled(true); addquestion.addView(weboption1); weboption1.postDelayed(new Runnable() { @Override public void run() { weboption1.loadUrl("about:blank"); weboption1.loadDataWithBaseURL(null, result.qname, "text/html", "charset=UTF-8", null); // weboption1.loadData(result.qname, "text/html","UTF-8"); } }, 100); wv = new WebView(ExamStart.this); wv.setWebViewClient(new WebViewClient()); wv.getSettings().setJavaScriptEnabled(true); lvoption1.addView(wv); wv.postDelayed(new Runnable() { @Override public void run() { wv.loadUrl("about:blank"); wv.loadDataWithBaseURL(null, result.option1 + ") " + result.option1desc, "text/html", "UTF-8", null); } }, 100); wv1 = new WebView(ExamStart.this); wv1.setWebViewClient(new WebViewClient()); wv1.getSettings().setJavaScriptEnabled(true); lvoption2.addView(wv1); wv1.postDelayed(new Runnable() { @Override public void run() { wv1.loadUrl("about:blank"); wv1.loadDataWithBaseURL(null, result.option2 + ") " + result.option2desc, "text/html", "charset=UTF-8", null); //wv1.loadData(result.option2 + ") "+ result.option2desc, "text/html; charset=UTF-8", null); //wv1.loadData(result.option2 + ") "+ result.option2desc, "text/html", "UTF-8"); } }, 100); </code></pre> <p>there are around 90 questions for each attempt. some times webview.loaddatawithbaseurl returns blank .I dont know where i am going wrong. any suggestions or other better way to do this please let me know.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload