Does the Html.fromHtml in android only works in displayed texts?

37 Views Asked by At

Because i'm comparing the user Answer and the correct answer

if(etU1.getText().toString().equals(cquestion.get(0).getAnswer()))

Example the choice is "Brad's Drink" and even though the user types it correctly it is still wrong because the getAnswer is "Brad%$'s%# Drink". because the ArrayList that I made gets the html texts. Is there some way where I can remove the html texts before putting it in the array list?

1

There are 1 best solutions below

0
ismail alaoui On BEST ANSWER

i think you should remove " ' " before you compare

String str = etU1.getText().toString().replaceAll("[']"," ");
String strTwo = cquestion.get(0).getAnswer().replaceAll("[']"," ");

if(str.equals(strTwo)){
////// do your logic 
}