储存Spannable为字符串 [英] Storing Spannable to a string
问题描述
我正在写一个聊天应用程序,并解析表情图标我用code从这里的在android系统显示表情图标
我的聊天文本存储就像一个ArrayListSENDER | | TIME NON_PARSED_CHAT_TEXT
问题是,我有一个字符串的所有聊天信息(时间,发件人和聊天文本),和我分开,并在ListView连续显示它,每次我得到这个聊天文本,重新解析它的表情图标,有存储Spannable对象(聊天文本分析后,从结果中提供的有关功能),字符串中的时间和发送一个ArrayList任何可能的方式?
感谢
有存储Spannable对象(聊天文本分析后,从结果中提供的有关功能),字符串中的时间和发送一个ArrayList任何可能的方式?
块引用>欢迎您使用<一个href=\"http://developer.android.com/reference/android/text/Html.html#toHtml%28android.text.Spanned%29\"相对=nofollow>
toHtml()
在HTML
类,尽管这只能处理一些HTML输出,不是任意的东西。您也可以有一个
持有的ArrayList
的Spannable
而非字符串
的是转换Spannable
。i'm writing a chat application, and to parse emotion icons i use code from here displaying emoticons in android
my chat text is stored like "SENDER|TIME|NON_PARSED_CHAT_TEXT" in an ArrayList
the problem is that i have all chat messages (time and sender and chat text) in a single string, and i split it and display it in a row in a ListView, each time i get this chat text and re-parse it for the emotion icons, is there any possible way to store Spannable object (chat text after parsing resulted from the function in the question provided) to string in an ArrayList with the time and sender?
thanks
解决方案is there any possible way to store Spannable object (chat text after parsing resulted from the function in the question provided) to string in an ArrayList with the time and sender?
You are welcome to use
toHtml()
on theHtml
class, though that can only handle some HTML output, not arbitrary things.You could also have an
ArrayList
that holds theSpannable
rather than aString
conversion of thatSpannable
.这篇关于储存Spannable为字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!