Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Android Build a Self-Destructing Message Android App Adding Users Using Parse.com Error Messages with Dialogs

If a string is null, doesn't isEmpty() throw a Nullpointerexception when used?

Shouldnt we check for isEmpty OR ==null? At least thats how I remember it... But i might be worng.

1 Answer

Harry James
Harry James
14,780 Points

Hey Linxy!

I can totally see where you're coming from here! We still don't actually have a need for checking null because when we run getText(), if there is no text, we are just given an empty String "". We'll never actually be returned null from this method.


Hope this explains things but if there's still something you don't quite understand, give me a shout :)