I’m trying set a layout for textview
so I can use getEllipsisCount()
method. But below code returns null as layout value.
How can I take layout and
From the documentation:
public final Layout getLayout ()
Added in API level 1 Returns the Layout that is currently being used to display the text. This can be null if the text or width has recently changes.
So probably your text has changes or you call it too early.
Look at this answer where is stated
This only works after the layout phase, otherwise the returned layout will be null, so call this at an appropriate place in your code.