1

Here is the code, I want the image to be displayed.I also tried Size with it.

TextView textViewHtml = (TextView) findViewById(R.id.text_html_program);
        Spanned spanned = Html.fromHtml( "<b>text_html_program: Constructed from HTML programmatically.</b>"
                + "  Text with a <a href=\"http://www.google.com\">link</a> "
                +"<b><img src=\"http://innovativeprofessionaloffices.com/wp-content/uploads/2014/07/seo-for-small-business.jpg\" alt=\"testing\"></b>"
                + "created in the Java source code using HTML.");
        textViewHtml.setText(spanned);
        textViewHtml.setMovementMethod(LinkMovementMethod.getInstance());
Hitesh Danidhariya
  • 709
  • 1
  • 7
  • 14

1 Answers1

0

you can get the img tag using following pattern as below:

    String ptr= "src\\s*=\\s*([\"'])?([^\"']*)";
        Pattern p = Pattern.compile(ptr);
        Matcher m;
//find the img tag

  m = p.matcher(html_string_containg_img_Tag);
        if (m.find()) {
           m.group(2),img);//this line get the image tag from give string
        }

may this helpful for you