在android中,对字符串 是否为空的判断是很经常的,有时候我们使用equals 来判断还是会出现报空指针的情况,查看官方API你会发现这么一句话 Returns true if the string is null or 0-length,所以当String本身就是null时,你调用它的equals 时会报空指针异常,所以在android中对字符串是否为空的判断中最好使用android为我们提供的TextUtils.isEmpty()
在android中,对字符串 是否为空的判断是很经常的,有时候我们使用equals 来判断还是会出现报空指针的情况,查看官方API你会发现这么一句话 Returns true if the string is null or 0-length,所以当String本身就是null时,你调用它的equals 时会报空指针异常,所以在android中对字符串是否为空的判断中最好使用android为我们提供的TextUtils.isEmpty()