TextView chatOutput = (TextView) findViewById(R.id.textView4);
chatOutput.setText("", BufferType.SPANNABLE);
void updateChatOutput {
String previous = Html.toHtml((Spannable) chatOutput.getText());
if (!previous.equals("")) {
if (previous.substring(0, 13).equals("<p dir=\"ltr\">"))
previous = previous.substring(13, previous.length()-3); //remove <p dir="ltr"> and </p>
else
previous = previous.substring(3, previous.length()-3); //remove <p> and </p>
}
chatOutput.setText(Html.fromHtml(message.substring(2, message.length()) + "<br>" + previous));
}
Figured it out. Changing the cast to Spannable and have used the setText method with the BufferType.SPANNABLE solved the orginal problem.
Then a follow-up issue occurred, weird line braking in the textview. Turned out that html-paragraph code was added somewhere in this process, ugly solution below when manually deleting it. The solution got even more tacky when I realised that additonal parameters in the paragraph-statement was added by a device with API 18, compared my testing device with API 8.