Because String.isEmpty() didn't exist in 2.2. You can verify this by looking at http://developer.android.com/reference/java/lang/String.html#isEmpty() and checking the "Filter by API level" option at the top.
You should use TextUtils.isEmpty() instead. On Tue, Nov 1, 2011 at 12:40 PM, Doug Gordon <[email protected]> wrote: > Why in the world would my app crash with a "No such method" Java error on > a statement like "if (!myString.isEmpty()" for a perfectly valid String > object? If I simply change it to "if (myString.length() > 0)" it works just > fine, so it's not like I'm not pointing to a valid String object or > anything. > > Interestingly, this only appears to happen when running it on my actual > Android 2.2 phone. It works OK on a V2.3.3 emulator. It is built with the > V2.3.3 SDK. What gives? > > Doug Gordon > GHCS Software > > -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to > android-developers@**googlegroups.com<[email protected]> > To unsubscribe from this group, send email to > android-developers+**[email protected]<android-developers%[email protected]> > For more options, visit this group at > http://groups.google.com/**group/android-developers?hl=en<http://groups.google.com/group/android-developers?hl=en> > -- Romain Guy Android framework engineer [email protected] -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

