Android Edittext: Get LineCount in an Activity's onCreate()
问题 How can I do getLineCount() of an Edittext in the onCreate() method of an activity, having changed the Edittext's text, like the following: @override public void onCreate(Bundle savedInstanceState){ myEditText.setText("EXAMPLE"); myEditText.getLineCount(); } Because the view has not been drawn yet getLineCount() will always return 0. Is there a way to get around this problem? Thanks! 回答1: Ugh, it's a problem with UI everywhere. You can use a Handler. You'll post a Runnable that will get the