This week only. Pastebin PRO Accounts Christmas Special! Don't miss out!Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Dec 31st, 2012  |  syntax: None  |  size: 0.54 KB  |  views: 270  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1.         SpannableStringBuilder builder = new SpannableStringBuilder();
  2.         String red = "I am RED ";
  3.         SpannableString redSpannable= new SpannableString(red);
  4.         redSpannable.setSpan(new ForegroundColorSpan(Color.RED), 0, red.length(), 0);
  5.         builder.append(redSpannable);
  6.        
  7.         EditText et = (EditText)findViewById(R.id.editText1);
  8.         et.setText(builder, BufferType.SPANNABLE);
  9.        
  10.         int position = et.length();
  11.         Editable etext = et.getText();
  12.         Selection.setSelection(etext, position);
clone this paste RAW Paste Data