Android examples for User Interface:EditText
reset EditText
import android.text.Spannable; import android.text.SpannableString; import android.text.style.BackgroundColorSpan; import android.text.style.CharacterStyle; import android.widget.EditText; import java.util.ArrayList; public class Main{ public static void reset(EditText editText) { Object[] spans = editText.getText().getSpans(0, editText.length(), Object.class); for (Object span : spans) { if (span instanceof CharacterStyle) { editText.getText().removeSpan(span); }/*from w ww. jav a2 s . c om*/ } } }