Reputation: 1
In Android, I have an Edittext view containing Spannable text including images in that. when I convert it to HTML using "toHTML" I am getting image source as a null. Anybody help me how to get the name of image in place of null.
example i have content like "abhi"[Some image]
when I convert it I am getting HTML as below.
<p dir="ltr"><img src="null"> <u>abhi</u></p>
Instead of that i want
<p dir="ltr"><img src="imagename"> <u>abhi</u></p>
Upvotes: 0
Views: 281
Reputation: 2256
It depends on how the spanned text is constructed. Suppose the image contained in the spanned text is an ImageSpan instance.
ImageSpan has many constructors:
Those constructors will assign a value to mSource(an internal member of ImageSpan), which will be later used by Html.toHtml() to generate a valid src.
Other commonly used constructor of ImageSpan:
When image in spanned text is created using above constructors, you will get null as src.
Upvotes: 1