public static boolean extendDown(Spannable text,Layout layout){
  int end=getSelectionEnd(text);
  int line=layout.getLineForOffset(end);
  if (line < layout.getLineCount() - 1) {
    int move;
    if (layout.getParagraphDirection(line) == layout.getParagraphDirection(line + 1)) {
      float h=layout.getPrimaryHorizontal(end);
      move=layout.getOffsetForHorizontal(line + 1,h);
    }
 else {
      move=layout.getLineStart(line + 1);
    }
    extendSelection(text,move);
    return true;
  }
 else   if (end != text.length()) {
    extendSelection(text,text.length());
    return true;
  }
  return true;
}

public static boolean extendDown ( Spannable text , Layout layout ) { int end = getSelectionEnd ( text ) ; int line = layout . getLineForOffset ( end ) ; if ( line < layout . getLineCount ( ) - 1 ) { int move ; if ( layout . getParagraphDirection ( line ) == layout . getParagraphDirection ( line + 1 ) ) { float h = layout . getPrimaryHorizontal ( end ) ; move = layout . getOffsetForHorizontal ( line + 1 , h ) ; } else { move = layout . getLineStart ( line + 1 ) ; } extendSelection ( text , move ) ; return true ; } else if ( end != text . length ( ) ) { extendSelection ( text , text . length ( ) ) ; return true ; } return true ; }
move the selection end to the buffer offset physically below the current selection end .
