Does EditText.getText() ever returns null?

getText() will not return null. So there is no chance for NPE in following method. the getText will return empty string if there is no string, which is definitely not null


However the edittext itself can be null if not initialized properly, Hence the following will trigger NPE


Leave a Comment