Try doing this i hope this is what you realyy want
richTextView = (TextView)findViewById(R.id.rich_text);
// this is the text we'll be operating on
SpannableString text = new SpannableString("hello how are you");
// make "hello" to (characters 0 to 5) red color
text.setSpan(new ForegroundColorSpan(Color.RED), 0, 5, 0);
richTextView.setText(text, BufferType.SPANNABLE);
And if you want it to show it as toast try this instead of setText use it like this
Toast.makeText(context, text, Toast.LENGTH_LONG).show();
.
stackoverflow.comm
No comments:
Post a Comment