1

I am loading a html from the assets folder. It is positioned below an image-view. The code works, however it takes a second for the html file to appear on the device.

here is the code:

 public class FgmIsChildAbuse extends Activity  {


@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.webview);

     WebView mWebView;
        mWebView = (WebView) findViewById(R.id.webviewm1);

        WebSettings webSettings = mWebView.getSettings();
        webSettings.setJavaScriptEnabled(true);

        mWebView.loadUrl("file:///android_asset/m1_section1_read.html");

        ImageView ImageView1 = (ImageView) findViewById(R.id.ImageView1);

        Resources res = getResources(); /** from an Activity */

        ImageView1.setImageDrawable(res.getDrawable(R.drawable.images_eyes));

        mWebView.getSettings().setRenderPriority(RenderPriority.HIGH);

        mWebView.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);

        mWebView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);

        webSettings.setRenderPriority(WebSettings.RenderPriority.HIGH);


   }


}

Below is an example of one of the html files

<html>
<head>
<title>CFAB</title>
<meta name="viewport" content="width=300, initial-scale=1" />
<link rel="stylesheet" media="all" href="master.css" type="text/css" />

</head>

<body bgcolor=transparent>
<FONT COLOR="#000000" size = 3>

<div class="outer" data-role="page" data-theme="a">
    <div class="main" data-role="content">

        <div class="tab-content">
            <div class="tab1 readtab">


                <h3>Female Genital Mutilation (FGM) is Child Abuse</h3>

                <p>Over <strong>100,000</strong> women in the UK have been <strong>victims</strong> of Female Genital Mutilation (FGM). The vast majority of these victims will have been subjected to this horrific form of abuse either <strong>before they came to the UK</strong> or they will have been taken, as children, to their parents' <strong>country of origin</strong> to undergo this abuse.</p>

                <p>This awareness course is designed to help <strong>practitioners</strong> understand what FGM is as well as the context within which it takes place and the relevant legislation to combat it. Critically, it is to build <strong>confidence</strong> so that professionals are better prepared to identify those children most at risk of FGM and those who may have been victims of this type of abuse.</p>



          </div> 
    </div>
    </div>
</div>
</body>
</html>
user3156801
  • 137
  • 1
  • 2
  • 12
  • just want better performance – user3156801 Sep 15 '14 at 09:39
  • Is the file large with lots of elements like images and other items? – erad Sep 15 '14 at 09:44
  • What version of Android are you running this on? – Nachi Sep 15 '14 at 10:02
  • android version 4.4.2 – user3156801 Sep 15 '14 at 10:04
  • LOL.. by looking at your html code, I can understand that you are writing code for nokia 3110... or 1100.. `font` and `bgcolor` already deprecated. Use CSS instead... Just kidding... BTW, [this](http://stackoverflow.com/questions/12740082/webview-loads-slowly-in-android) or [this](http://stackoverflow.com/questions/7422427/android-webview-slow) may help you.... – Ravimallya Nov 10 '14 at 12:49

0 Answers0