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!
Ugh, it's a problem with UI everywhere.
You can use a Handler. You'll post a Runnable that will get the line count and continue the processing.