TextView t=(TextView)findViewById(R.id.yourtextview);
String text = "<fontcolor=#cc0029>Erste Farbe</font><font color=#ffcc00>zweiteFare</font>";
yourtextview.setText(Html.fromHtml(text));
NPEを取得して、インターネット許可も追加しました。
あなたのテキストビューの代わりにtを使用してください
TextView t=(TextView)findViewById(R.id.yourtextview);
String text = "<fontcolor=#cc0029>Erste Farbe</font><font color=#ffcc00>zweiteFare</font>";
t.setText(Html.fromHtml(text));
テキストビューのIDではなく、テキストビューにテキストを設定する必要があります。
これをやってみてください
t.setText(Html.fromHtml(text));
TextView ID を呼び出す代わりに TextView t を呼び出す必要があります。
t.setText(Html.fromHtml(text));
代わりに
これを使用してくださいyourtextview.setText(Html.fromHtml(text));
以下のコード行を変更してください
t.setText(Html.fromHtml(text));
それ以外の
yourtextview.setText(Html.fromHtml(text));