What I mean is, is it possible to change the text \"This text is blue\" to the color blue in a single string? There must be a way...
You can try this: In a fragment :
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(
R.layout.shipment_accepted_fragment,
container, false);
String email = "(abc@gmail.com)";
TextView shipment_email = (TextView) rootView
.findViewById(R.id.textview);
String text_shipment_email = "Hello"
+ " " + email
+ ""
+ "Bye";
shipment_email.setText(Html.fromHtml(text_shipment_email),
TextView.BufferType.SPANNABLE);
}