Html.fromHtml not working

android

Solution

Thats because the `Spanned` returned from `Html.fromHtml` gets used as a normal String (thereby loosing any formatting) when you try to concatenate it with "0.0". To make this work, pass the whole stuff into `fromHtml`:

Html.fromHtml("0.0<small>" + StringResult() + "</small>")

The same principle applies in more complex cases:

lblResult.setText(Html.fromHtml(String.format("%.1f", myCalc) + " " + "<br>" +
    "<small>" + StringResult() + "</small>"));

Problem

I have a textview and I want to display 0.0 in normal fontSize of the TextView and then the StringResult() in a smaller text size. If I add "0.0" + it's not working. Why? ``` public String StringResult(){ String displayLbl = this.getResources().getString(R.string.displayLbl); TextView myUnitLbl = (TextView)findViewById(R.id.lbl_unit_res); String myFinalLbl = displayLbl + " " + myUnitLbl.getText() + " "; return myFinalLbl; } public void cmd_rst(View v){ TextView lblText = (TextView) findViewById(R.id.lblresult); lblText.setText("0.0" + Html.fromHtml("<small>" + StringResult() + "</small>")); } ```

Original source