Replace .isEmpty() with .length() == 0 to make Android 2.2 compatible