Yes, but Html.fromHtml() interprets the html and takes action accordingly (showing images and such) and I just want to strip any visual formatting and get a readable text version.
I tried Html.fromHtml(htmlSrc).toString(); and that almost does the trick, but it inserts some ugly character on every image tag. Anyway, I've made a simple regex to clean it up that hopefully will catch everything I want gone so I'll drop this for now. /Martin On Jun 12, 1:33 pm, Mark Murphy <[email protected]> wrote: > On 06/12/2010 06:47 AM, Martin Wallgren wrote: > > > Hi > > > Are there any built in functionality that will strip out html tags > > from a String? I could write it my self, I just don't want to reinvent > > the wheel if it already exists. > > There is built-in functionality to convert HTML into a Spannable, so the > HTML tags take effect in, say, a TextView -- see Html.fromHtml(). > > Beyond that, I am aware of nothing in the SDK to de-tag HTML. > > -- > Mark Murphy (a Commons > Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy > > Android 2.2 Programming Books:http://commonsware.com/books -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

