0

when I am trying to change text on EditText by calling setText, the function called getLineCount on editText is always 0 after that, why it doesn't change?

1 Answers1

1

If you call getLineCount immediately then it will be always zero because TextView needs some time to draw itself completely.

Try to call this after setText :

editText.post(new Runnable() {
    @Override
    public void run() {
        Log.d("Count", editText.getLineCount().toString());
    }
});
Meet Prajapati
  • 416
  • 5
  • 9