Here is my code where return response is that text which i want to be formatting. At start program i choose option after what i choose it will display this answer.
String getResponse(String selectedOption) { // Pass the selected option as a parameter
String response;
if (selectedOption.toLowerCase().contains("5 secret rules")) {
response =
"5 secret rules to be succesful";
} else if (selectedOption.toLowerCase().contains("life")) {
response =
"The meaning of life .";
} else if (selectedOption.toLowerCase().contains("joke")) {
response =
"Why don't scientists trust atoms? Because they make up everything.";
} else {
response =
"I'm sorry, I didn't understand that. Can you please try again?";
}
return response;
}
Thank youfor help.
Itried many ways really dont know how to do it. Actuall result is unformatted text. I want it to look better some word can be bold other word in different color.