Get currently invisible text from multiline textview android

  • Replies:0
  • OpenNot stickiedUnanswered
  • Forum posts: 1

Dec 28, 2014 1:00:31 PM via Website

I have a multi-line textview.Its height is depend on other view.I want to get the invisible text from the textview.

I have tried this code to get the invisible text but its showing only empty text but the textview have invisible text

final TextView shortDescription = (TextView) v.findViewById(;

ViewTreeObserver vto = shortDescription.getViewTreeObserver();
vto.addOnGlobalLayoutListener(new OnGlobalLayoutListener() {
    public void onGlobalLayout() {
        String text = list.get(position).getDescription();
        Layout layout = shortDescription.getLayout();
        int end = layout.getLineEnd(layout.getLineCount() - 1);
        String invisibletext = text.substring(end, text.length());
        Log.e("TAG", "Invisible text:" + invisibletext);