I have one problem to show text with different color word then I search it and find this page
Change text color of one word in a TextView
and this page
Different font size of strings in the same TextView
and this page
How to load external webpage inside WebView
there answer does not solve my problem because I have very long text to colored it and also I want text like that image
and this code for one word like image not work
final SpannableStringBuilder ssb = new SpannableStringBuilder();
final int flag = Spannable.SPAN_EXCLUSIVE_EXCLUSIVE;
//converting arabic text to unicode chars
String dd= "بِسْمِ" ;
ssb.append(dd);
//applying colors
ssb.setSpan(new ForegroundColorSpan(Color.RED), 1, 2, flag);
ssb.setSpan(new ForegroundColorSpan(Color.RED), 3, 4, flag);
ssb.setSpan(new ForegroundColorSpan(Color.RED), 5, 6, flag);
//seting formated spanned text
TextView mTextView=(TextView) findViewById(R.id.textView);
mTextView.setText(ssb);
Please answer this question with simple code