title: How to use textview.getLayout()? It returns null
body: <p>I’m trying set a layout for <code>textview</code> so I can use <code>getEllipsisCount()</code> method. But below code returns null as layout value.
  How can I take layout and then use <code>getEllipsisCount(0)</code> method.</p>
  <pre><code>public class MainActivity extends Activity {
  
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
          TextView mytextview =(TextView) findViewById(R.id.textView1);
          mytextview.setText(myText);
      
          Layout layout = mytextview.getLayout();
          if(layout != null){
              mytextview.setText(&quot;very good layout worked\n&quot;);
          }
      }
  }
  </code></pre>