Storing Spannable to a string

泄露秘密 提交于 2019-12-11 18:57:59

问题


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


回答1:


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 the Html class, though that can only handle some HTML output, not arbitrary things.

You could also have an ArrayList that holds the Spannable rather than a String conversion of that Spannable.



来源:https://stackoverflow.com/questions/14900449/storing-spannable-to-a-string

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!