4

after asking a question about Place Button just after end of TextView in multilline TextView I give no answer but I think if find the position of end character of final line of textview , then my problem is solved .
so how could find out the end of text position in last line of textview?
tank's for your help and your attention.

Community
  • 1
  • 1
MahdiSa
  • 101
  • 1
  • 9

1 Answers1

0
CharSequence cs = textView.getText();
int position = cs.charAt(cs.length()-1);
Steven Mann
  • 558
  • 3
  • 14
  • Tank's , but the position represent what? – MahdiSa Jun 25 '13 at 20:41
  • The index of the last character. I would use it to hack in a link. – Steven Mann Jun 25 '13 at 20:42
  • so is there a way to find it's position(X,Y)? – MahdiSa Jun 25 '13 at 20:45
  • Obtusely with [this](http://www.javadocexamples.com/java/awt/Component/getLocationOnScreen%28%29.html). If you are going to just throw a button in, do it in the xml with a relative layout. – Steven Mann Jun 25 '13 at 20:48
  • It does not work because the textview width is constant for all lines and that's equal to line one width's . I need find the position of end character of my textview , with that component how could do this ? thanks for your attention – MahdiSa Jun 25 '13 at 20:57