title: How to pass html string to webview on android?
body: <p>I am parsing xml and then loading it to web view. After parsing, I am creating four strings so that I could append all strings to one view. I am able to get two views on the web view, but not the first two strings.</p>
  <p>Please suggest in my code, where I am going wrong and the correct way to get the formatted html strings on the web view.</p>
  <pre><code>@Override
      public View getView(int position, View convertView, ViewGroup parent) {
          // TODO Auto-generated method stub
          String chapterTitle = &quot;&quot;;
          String SubChapterTitle=&quot;&quot;;
          String chapterIntro =&quot;&quot;;
          String chapterContent=&quot;&quot;;
          View view = convertView;
          if (convertView == null) {
              // view = inflater.inflate(resourceid, null);
              view = getLayoutInflater().inflate(R.layout.webviewitem, null);
          }
          synchronized (view) {
              WebView wv = (WebView) view.findViewById(R.id.contentWebView);
  
              WebSettings settings = wv.getSettings();
              settings.setUseWideViewPort(true);
              settings.setLoadWithOverviewMode(true);
              settings.setJavaScriptEnabled(true);
              settings.setDefaultZoom(ZoomDensity.FAR);
              // wv.setBackgroundColor(0);
              wv.setVerticalScrollBarEnabled(false);
              wv.setHorizontalScrollBarEnabled(false);
              /*String txtChapTitle = Intro.book.getsecretList().get(position)
                      .getChtitle().toString();*/
              
              if (!(Intro.book.getsecretList().get(position).getChtitle()
                      .toString().equals(&quot;&quot;))){
              chapterTitle = &quot;&lt;b&gt;&lt;fontSize=4&gt;&quot;+Intro.book.getsecretList().get(position)
              .getChtitle().toString()+&quot;&lt;/font&gt;&lt;/b&gt;&quot;;
              }
              if (!(Intro.book.getsecretList().get(position)
                      .getSubtitle() == null)) {
                  SubChapterTitle = &quot;&lt;b&gt;&lt;fontSize=4&gt;&quot;+Intro.book.getsecretList().get(position)
                  .getSubtitle().toString()+&quot;&lt;/font&gt;&lt;/b&gt;&quot;;
              }
              if (!(Intro.book.getsecretList().get(position)
                      .getIntro() == null)) {
              chapterIntro = &quot;&lt;b&gt;&lt;fontSize=2&gt;&quot;+Intro.book.getsecretList().get(position)
                  .getIntro().toString()+&quot;&lt;/font&gt;&lt;/b&gt;&quot;;
              }
              if (!(Intro.book.getsecretList().get(position)
                      .getContent() == null)) {
              chapterContent = &quot;&lt;fontSize=2&gt;&quot;+Intro.book.getsecretList().get(position)
                  .getContent().toString()+&quot;&lt;/font&gt;&quot;;
              }
              
              StringBuilder content = new StringBuilder();
              content.append(chapterTitle+SubChapterTitle+chapterIntro+chapterContent);
              
              JsInterface Jsi = new JsInterface();
              Jsi.wordDef = content ;
              Log.v(&quot;Content&quot;, &quot;&quot; +content);
              wv.addJavascriptInterface(Jsi, &quot;interfaces&quot;);
  
              wv.setWebViewClient(new WebViewClient() {
                  @Override
                  public void onPageFinished(WebView view, String url) {
                      view.setHapticFeedbackEnabled(false);
                  }
              });
  
              wv.setWebChromeClient(new WebChromeClient() {
                  @Override
                  public boolean onJsAlert(WebView view, String url,
                          String message, JsResult result) {
                      return super.onJsAlert(view, url, message, result);
                  }
              });
              
              wv.loadUrl(&quot;file:///android_asset/wordview.html&quot;);
          }
          return view;
      }
  }
  </code></pre>
  <p>I am able to get <code>chapterIntro</code> and <code>chaptercontent</code> on the web view, but not the first two strings.</p>