I am receiving String
frames from two different channels and I want to show them in a single TextView
but with two different colors, for this I am using Html.fromHtml()
to color the second frame, the color change works but for some reason eliminates the special characters of change of lines ("\ n") and the textview
shows it like this:
When it should instead the textview
should show:
Here is my code, can someone tell me how to correct this?
mDumpTextView = (TextView) findViewById(R.id.tv1_ReadValues);
mScrollView = (ScrollView) findViewById(R.id.sc1_Scroller);
.
.
public void handleMessage(Message msg) {
switch (msg.what) {
case UsbService.SYNC_READ:
String buffer = (String) msg.obj;
if(msg.arg1 == 0){
mActivity.get(). mDumpTextView.append(buffer);
}else if(msg.arg1 == 1){
mActivity.get().mDumpTextView.append( Html.fromHtml( redB + buffer + colorEnd ) );
mScrollView.smoothScrollTo( 0, mDumpTextView.getBottom() );
}
break;
}
}