Code example for Spannable

Methods: removeSelection, setSpan

0
        text.removeSpan(FROM_BELOW);
    } 
 
    @Override 
    public void onTakeFocus(TextView view, Spannable text, int dir) {
        Selection.removeSelection(text);
 
        if ((dir & View.FOCUS_BACKWARD) != 0) {
            text.setSpan(FROM_BELOW, 0, 0, Spannable.SPAN_POINT_POINT);
        } else { 
            text.removeSpan(FROM_BELOW);
        } 
    } 
 
    public static MovementMethod getInstance() {
        if (sInstance == null)
            sInstance = new MyLinkMovementMethod();
 
        return sInstance;
    }