Hello Friends i set two different color in single textview like below
My code is as below
public static String getAnswers(List<Question> questions) {
int question = 1;
StringBuffer sb = new StringBuffer();
for (Question q : questions){
String d= "<font color=#292929>" + sb.append("Q").append(question).append(") ").append(q.getQuestion()).append("? \n")+"</font>";
String ss="<font color=#ce4e00>"+sb.append("Answer: ").append(q.getAnswer()).append("\n\n")+"</font>";
AnswersActivity.results.setText(Html.fromHtml(d+ss),TextView.BufferType.SPANNABLE);
question ++;
}
return sb.toString();
}
and is textview i set
mStringQustion = Utility.getAnswers(currentGame.getQuestions());
and get output like below
How can i solve it ?