I'm using SpannableString in my app, I just wanted to change its content to prevent to declare new SpannableString
because I want to change its content more and more again ...
this is my Code :
SpannableString span;
span = new SpannableString(getResources().getString(R.string.C1_1));
//DO STH WITH span
span = new SpannableString(getResources().getString(R.string.Q1_1));
//DO STH DIFFERENT WITH span
how can I reference one SpannableString
and just change its content?
Since SpannableString is immutable object the only way to “change” value is by creating a new object.
There is a mutable SpannableStringBuilder class which might help you. You can read the documentation here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With