-
Notifications
You must be signed in to change notification settings - Fork 105
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Converting text to HTML doesn't work for bold and italic #1
Comments
I can't reproduce the issue, it works perfectly for me, mRTMessageField.getText(RTFormat.HTML) returns html for Italic and Bold. The rich text editor is used in thousands of installations, if there was indeed that issue, my users would have complained already. |
The saved HTML file is completely empty, but that's another problem. |
My Nexus 5 (although running Android M) has no such issue. Also tested it on an S3 running KitKat. I don't want a workaround for an issue if the root cause isn't known and might lead to other (yet unknown) issues. As I said thousands of users use this component and no one has ever reported anything like this so let's find out what's special about your device. Anything out of the ordinary on your device? rooted? custom 4.4.4? any suspicious apps installed? do you use a custom font? BTW I suggest you contact me by email to solve this: 1gravityllc@gmail.com |
After some more tests I've found the proper scenario to reproduce the problem:
That should be it. The problem is that the onSaveInstanceState method in TextView uses the TextUtils#writeToParcel method for saving text and this method can handle only built-in spans. I don't think that it's possible to extend this mechanism for custom spans.
|
I went for option 3 ;-). The proper way to handle this is to save the view state in onSaveInstanceState and restore it in onRestoreInstanceState. By saving the text as html and restoring it from that html we can retain all custom span objects. Fixed with 9ac8f6a |
Indeed, the third solution sounds better:) |
Hello
instead of<b>Hello</b>
The text was updated successfully, but these errors were encountered: