i have a string in strings.xml file. clicks on some part of this string redirect to a task. that some part where made based on the index of the string.
Now i am trying to translate it to french but i am getting index out of bound exception as its less then the length of English strings.
Could anyone please say, what will be the best way to handle this scenario?
String separation is one thing we can do.
but i want to handle it in one text view itself.
Code for the English String:
SpannableString spannableString = new SpannableString(getResources().getString(R.string.desc));
ClickableSpan clickableSpan = new ClickableSpan() {
@Override
public void onClick(View textView) {
Log.v("dosomething", "dosomething");
}
@Override
public void updateDrawState(TextPaint ds) {
Log.v("task one", "task one");
}
};
spannableString.setSpan(clickableSpan, 87, spannableString.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
mDesc.setText(spannableString);
mDesc.setMovementMethod(LinkMovementMethod.getInstance());
int start
forsetSpan()
method. – Darnley