Compatibility with Android < 2.3 and Java < 6

String's isEmpty() is not available in Android < 2.3 and Java < 6. To
fix this two uses of isEmpty() were replaced with length() == 0. This
is more ugly but allows using this library on two outdated platforms.