1

So i want that is possible to see things in html like 50% and not just text or link also if it's possible that it's shows pictures. i think you see what i want to do that with the same html code than for a webpage it shows the same things.

this is my code

TextView tv = (TextView) findViewById( R.id.textView4 );
tv.setMovementMethod( LinkMovementMethod.getInstance() );
tv.setText( Html.fromHtml( String.valueOf( str ) )  );

thanks for helping i didn't see something on the net that helped me.

2 Answers2

0

You need to implement Html.ImageGetter in your class that is processing the HTML. Then you will need to override getDrawable() which gets triggered when Html.fromHtml() encounters a src attribute in the html. You can read more about it here:

From the Android docs on getDrawable():

This method is called when the HTML parser encounters an tag. The source argument is the string from the "src" attribute; the return value should be a Drawable representation of the image or null for a generic replacement image. Make sure you call setBounds() on your Drawable if it doesn't already have its bounds set.

Example implementation with AsyncTask

Important part is to use an AsyncTask or an IntentService to download the images on a separate thread.

David Velasquez
  • 2,346
  • 1
  • 26
  • 46
-2

If you want to display something in textview like html format then you try to:

tv.setText( Html.fromHtml("

Title


Description here

"));

https://stackoverflow.com/a/2116191/6804857