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 <gordo...@gmail.com> 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<android-developers@googlegroups.com>
> To unsubscribe from this group, send email to
> android-developers+**unsubscr...@googlegroups.com<android-developers%2bunsubscr...@googlegroups.com>
> 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
romain...@android.com

-- 
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
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to